Manual Release #15
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
name: Manual Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version for the release" | |
required: true | |
default: "0.0.0" | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
name: Build project | |
uses: ./.github/workflows/build.yaml | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch depth 0 to get all tags and commits to generate release note changelog | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-Windows | |
path: windows | |
- name: Download Linux artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-Linux | |
path: linux | |
- name: Download macOS artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-macOS | |
path: macos | |
- name: Rename artifacts | |
run: | | |
mv linux/${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}-linux-${{ inputs.version }}.zip | |
mv windows/${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}-windows-${{ inputs.version }}.zip | |
mv macos/${{ github.event.repository.name }}.zip ${{ github.event.repository.name }}-macos-${{ inputs.version }}.zip | |
- name: Get previous release | |
run: | | |
PREVIOUS_RELEASE=$(gh release list --repo ${{ github.repository }} --json tagName --jq '.[].tagName' | head -n 1) | |
echo "PREVIOUS_RELEASE=$PREVIOUS_RELEASE" >> $GITHUB_ENV | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Create changelog | |
run: git log $PREVIOUS_RELEASE..HEAD --oneline --no-merges >> release_note.txt | |
- name: Create new release | |
run: > | |
gh release create v${{ inputs.version }} | |
${{ github.event.repository.name }}-linux-${{ inputs.version }}.zip | |
${{ github.event.repository.name }}-windows-${{ inputs.version }}.zip | |
${{ github.event.repository.name }}-macos-${{ inputs.version }}.zip | |
--repo ${{ github.repository }} | |
-F release_note.txt | |
-t "Ficsit Companion v${{ inputs.version }}" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- release # Only deploy if a release was successfully created | |
steps: | |
- name: Download web artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ github.event.repository.name }}-web | |
- name: Unzip web | |
run: cmake -E tar "xzf" "${{ github.event.repository.name }}.zip" | |
- name: Upload raw files for pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: web | |
- name: Deploy to GitHub Pages | |
id: deployment | |
# Will automatically fetch the artifact "github-pages" uploaded using actions/upload-pages-artifact@v3 | |
uses: actions/deploy-pages@v4 |