Skip to content

Commit

Permalink
ci: simplify release workflow (#3642)
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser authored Aug 22, 2024
1 parent 8a63485 commit 6c63a39
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 45 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/draft-new-release.yaml

This file was deleted.

60 changes: 50 additions & 10 deletions .github/workflows/release-pipeline.yaml
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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 6c63a39

Please sign in to comment.