-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: simplify release workflow (#3642)
- Loading branch information
Showing
2 changed files
with
50 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,48 @@ | ||
name: 🏭 Release Pipeline | ||
name: 🏭 Draft Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
workflow_dispatch: | ||
inputs: | ||
bump: | ||
description: 'Semver Bump Type' | ||
required: true | ||
default: 'patch' | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
cut_release: | ||
name: Cut Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
new_tag: ${{ steps.set_tag.outputs.new_tag }} | ||
steps: | ||
# Docs - https://github.com/mathieudutour/github-tag-action | ||
- name: Bump Version and Push Tag | ||
if: github.repository == 'open-goal/jak-project' | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag_prefix: v | ||
default_bump: ${{ github.event.inputs.bump }} | ||
|
||
- name: Create Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release create ${{ steps.tag_version.outputs.new_tag }} --generate-notes --draft --repo ${{ github.repository }} | ||
|
||
- name: Output new tag | ||
id: set_tag | ||
run: | | ||
echo "new_tag=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT | ||
# Windows | ||
build_windows_clang: | ||
name: "🖥️ Windows" | ||
|
@@ -40,13 +77,16 @@ jobs: | |
upload_artifacts: | ||
if: github.repository == 'open-goal/jak-project' | ||
needs: | ||
- cut_release | ||
- build_windows_clang | ||
- build_linux_clang | ||
- build_macos_intel | ||
name: "Upload Artifacts" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.cut_release.outputs.new_tag }} | ||
|
||
- name: Prepare Artifact Folder | ||
run: mkdir -p ./ci-artifacts/final | ||
|
@@ -64,7 +104,7 @@ jobs: | |
mkdir -p ./ci-artifacts/linux | ||
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/linux ./ci-artifacts/opengoal-linux-static ./ | ||
pushd ci-artifacts/linux | ||
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}') | ||
TAG_VAL=${{ needs.cut_release.outputs.new_tag }} | ||
tar czf ../final/opengoal-linux-${TAG_VAL}.tar.gz . | ||
popd | ||
chmod +x ./ci-artifacts/opengoal-linux-static/lsp/lsp | ||
|
@@ -74,7 +114,7 @@ jobs: | |
run: | | ||
mkdir -p ./ci-artifacts/windows | ||
./.github/scripts/releases/extract_build_windows.sh ./ci-artifacts/windows ./ci-artifacts/opengoal-windows-static ./ | ||
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}') | ||
TAG_VAL=${{ needs.cut_release.outputs.new_tag }} | ||
7z a -tzip ./ci-artifacts/final/opengoal-windows-${TAG_VAL}.zip ./ci-artifacts/windows/* | ||
cp ./ci-artifacts/opengoal-windows-static/lsp.exe ./ci-artifacts/final/opengoal-lsp-windows-${TAG_VAL}.exe | ||
|
@@ -83,7 +123,7 @@ jobs: | |
mkdir -p ./ci-artifacts/macos | ||
./.github/scripts/releases/extract_build_unix.sh ./ci-artifacts/macos ./ci-artifacts/opengoal-macos-static ./ | ||
pushd ci-artifacts/macos | ||
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}') | ||
TAG_VAL=${{ needs.cut_release.outputs.new_tag }} | ||
tar czf ../final/opengoal-macos-intel-${TAG_VAL}.tar.gz . | ||
popd | ||
chmod +x ./ci-artifacts/opengoal-macos-static/lsp/lsp | ||
|
@@ -93,12 +133,12 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}') | ||
TAG_VAL=${{ needs.cut_release.outputs.new_tag }} | ||
gh release upload "${TAG_VAL}" ${{ github.WORKSPACE }}/ci-artifacts/final/* --repo open-goal/jak-project --clobber | ||
- name: Publish Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_PAT }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
TAG_VAL=$(echo ${{ github.REF }} | awk -F'refs/tags/' '{print $2}') | ||
TAG_VAL=${{ needs.cut_release.outputs.new_tag }} | ||
gh release edit ${TAG_VAL} --draft=false --repo open-goal/jak-project |