Skip to content

Commit 77846bc

Browse files
authored
W-20004524: Set permissions on release (#104)
1 parent 90b503e commit 77846bc

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Release DataWeave Native CLI
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
27

3-
on: workflow_dispatch
48

59
jobs:
610

@@ -18,27 +22,21 @@ jobs:
1822
- os: macos-latest
1923
script_name: osx
2024
runs-on: ${{ matrix.os }}
25+
26+
# Set permissions
27+
permissions:
28+
contents: write
29+
2130
# Steps represent a sequence of tasks that will be executed as part of the job
2231
steps:
32+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2333
- uses: actions/checkout@v4
2434

25-
# Check tag
26-
- name: Check Tag
27-
id: check-tag
28-
run: |
29-
echo "Check tag ${{ github.event.ref }}"
30-
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
31-
echo "match=true" >> $GITHUB_OUTPUT
32-
fi
33-
34-
# Setup Gradle
3535
- name: Setup Gradle
36-
if: steps.check-tag.outputs.match == 'true'
3736
uses: gradle/actions/setup-gradle@v3
3837

3938
# Setup Graalvm
4039
- name: Setup Graalvm
41-
if: steps.check-tag.outputs.match == 'true'
4240
uses: graalvm/setup-graalvm@v1
4341
with:
4442
# version: ${{env.GRAALVM_VERSION}}
@@ -47,27 +45,23 @@ jobs:
4745
github-token: ${{ secrets.GITHUB_TOKEN }}
4846

4947
- name: Guess Extension Version
50-
if: steps.check-tag.outputs.match == 'true'
5148
run: |
5249
echo "NATIVE_VERSION=$(echo '${{github.ref}}' | sed -e 's,.*/v\(.*\),\1,')" >> $GITHUB_ENV
5350
shell: bash
5451

5552
# Runs a single command using the runners shell
5653
- name: Run Build
57-
if: steps.check-tag.outputs.match == 'true'
5854
run: |
5955
./gradlew --stacktrace --no-problems-report build -PnativeVersion=${{env.NATIVE_VERSION}}
6056
shell: bash
6157

6258
# Generate distro
6359
- name: Create Distro
64-
if: steps.check-tag.outputs.match == 'true'
6560
run: ./gradlew --stacktrace --no-problems-report native-cli:distro -PnativeVersion=${{env.NATIVE_VERSION}}
6661
shell: bash
6762

6863
# Upload the artifact file
6964
- name: Upload binaries to release
70-
if: steps.check-tag.outputs.match == 'true'
7165
uses: svenstaro/upload-release-action@v2
7266
with:
7367
repo_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)