Skip to content

Commit fb484eb

Browse files
Merge pull request #291 from AikidoSec/make-release-workflow-trigger-a-tag-push
Make release.yml trigger a tag push
2 parents a4338c8 + 46e99d0 commit fb484eb

2 files changed

Lines changed: 51 additions & 54 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
name: 📦 Publish new Release
22

33
on:
4-
release:
5-
types: [created]
6-
7-
permissions:
8-
contents: write
9-
packages: write
10-
deployments: write
4+
push:
5+
tags:
6+
- "v*"
117

128
jobs:
13-
create-release-asset:
14-
runs-on: open-source-releaser
9+
extract-version:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.get_version.outputs.version }}
13+
steps:
14+
- name: Extract version from tag
15+
id: get_version
16+
run: |
17+
VERSION=${GITHUB_REF#refs/tags/v}
18+
echo "version=$VERSION" >> $GITHUB_OUTPUT
19+
echo "Version: $VERSION"
1520
21+
build:
22+
needs: extract-version
23+
runs-on: open-source-releaser
1624
steps:
1725
- name: Check out code
18-
uses: actions/checkout@v2
26+
uses: actions/checkout@v4
1927
- name: Set the version for this release
20-
run: |
21-
TAG_NAME=${GITHUB_REF##*/}
22-
make replace_version version=${TAG_NAME#v}
28+
run: make replace_version version=${{ needs.extract-version.outputs.version }}
2329
- name: Set up JDK
24-
uses: actions/setup-java@v2
30+
uses: actions/setup-java@v4
2531
with:
2632
java-version: '21'
2733
distribution: 'adopt'
2834
- name: Download binaries & Build with Gradle
29-
working-directory: ./
3035
run: chmod +x gradlew && make binaries && make build
3136
- name: Create zip and tar.gz files of the build
3237
run: |
@@ -37,43 +42,36 @@ jobs:
3742
run: |
3843
shasum -a 256 zen.zip > zen.zip.sha256sum
3944
shasum -a 256 zen.tar.gz > zen.tar.gz.sha256sum
40-
- name: Upload Release Asset
41-
uses: actions/upload-release-asset@v1
42-
env:
43-
GITHUB_TOKEN: ${{ github.token }}
45+
- name: Upload artifacts
46+
uses: actions/upload-artifact@v4
4447
with:
45-
upload_url: ${{ github.event.release.upload_url }}
46-
asset_path: ./zen.zip
47-
asset_name: zen.zip
48-
asset_content_type: application/zip
49-
- name: Upload Release Asset (SHA)
50-
uses: actions/upload-release-asset@v1
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
with:
54-
upload_url: ${{ github.event.release.upload_url }}
55-
asset_path: ./zen.zip.sha256sum
56-
asset_name: zen.zip.sha256sum
57-
asset_content_type: text/plain
58-
- name: Upload Release Asset (tar.gz)
59-
uses: actions/upload-release-asset@v1
60-
env:
61-
GITHUB_TOKEN: ${{ github.token }}
48+
name: release-artifacts
49+
path: |
50+
zen.zip
51+
zen.zip.sha256sum
52+
zen.tar.gz
53+
zen.tar.gz.sha256sum
54+
55+
release:
56+
needs: [extract-version, build]
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: write
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
63+
- name: Download all artifacts
64+
uses: actions/download-artifact@v4
6265
with:
63-
upload_url: ${{ github.event.release.upload_url }}
64-
asset_path: ./zen.tar.gz
65-
asset_name: zen.tar.gz
66-
asset_content_type: application/gzip
67-
- name: Upload Release Asset (tar.gz SHA)
68-
uses: actions/upload-release-asset@v1
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
name: release-artifacts
67+
- name: Create GitHub Release
68+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
7169
with:
72-
upload_url: ${{ github.event.release.upload_url }}
73-
asset_path: ./zen.tar.gz.sha256sum
74-
asset_name: zen.tar.gz.sha256sum
75-
asset_content_type: text/plain
76-
- name: Publish release
70+
draft: true
71+
files: |
72+
zen.zip
73+
zen.zip.sha256sum
74+
zen.tar.gz
75+
zen.tar.gz.sha256sum
7776
env:
7877
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
run: gh release edit ${{ github.event.release.tag_name }} --draft=false --repo ${{ github.repository }}

RELEASE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Releasing
22

3-
1. Go to **GitHub → Releases → Draft a new release**
4-
2. Choose a tag (e.g. `v1.2.3`) and set it as a **draft**
5-
3. Click **Save draft** — this triggers the release workflow
6-
4. The workflow builds the artifacts, uploads them to the draft, then publishes the release automatically
3+
1. Create and push a tag for the version you want to release (e.g. `git tag v1.2.3 && git push origin v1.2.3`) — this triggers the release workflow
4+
2. The workflow builds the artifacts and uploads them to a **draft** release on GitHub
5+
3. Go to **GitHub → Releases**, review the draft, then click **Edit → Publish release** to make it public

0 commit comments

Comments
 (0)