chore: testing new release-please versioning (#19) #22
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: Release Please | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
APP_NAME: WindowTool | |
VER_FILE: ./source/version.h | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Release Please | |
uses: google-github-actions/release-please-action@v4 | |
id: release | |
with: | |
token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
release-type: simple | |
- name: Generate & Commit Version Header | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
echo "// Do not modify this file, it is overwritten by release-please.yml!" > ${{ env.VER_FILE }} | |
echo "#pragma once" >> ${{ env.VER_FILE }} | |
echo "constexpr const wchar_t APP_VERSION[] = L\"${{ steps.release.outputs.tag_name }}\"" >> ${{ env.VER_FILE }} | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add ${{ env.VER_FILE }} | |
git commit -m "chore: update version header to ${{ steps.release.outputs.tag_name }}" | |
git push | |
build-x64: | |
name: Build x64 Release | |
needs: release | |
if: ${{ needs.release.outputs.release_created }} | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
platform: x64 | |
configuration: Release | |
build-x86: | |
name: Build x86 Release | |
needs: release | |
if: ${{ needs.release.outputs.release_created }} | |
uses: ./.github/workflows/build.yml | |
secrets: inherit | |
with: | |
platform: x86 | |
configuration: Release | |
publish: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
needs: [release,build-x64, build-x86] | |
if: ${{ needs.release.outputs.release_created }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "*-artifact" | |
merge-multiple: false | |
- name: Zip Artifacts | |
run: | | |
mv x86-artifact x86 | |
mv x64-artifact x64 | |
zip -r "${{ env.APP_NAME }}-${{ needs.release.outputs.tag_name }}.zip" x86 x64 LICENSE | |
- name: Upload Release Artifact | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload ${{ needs.release.outputs.tag_name }} "${{ env.APP_NAME }}-${{ needs.release.outputs.tag_name }}.zip" | |