Continuous Deployment #2
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: "Continuous Deployment" | |
permissions: read-all | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Continuous Integration"] | |
types: ["completed"] | |
branches: ["main"] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
info: | |
name: Gather package information | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
version: ${{ steps.output_version.outputs.version }} | |
exists: ${{ steps.check-tag.outputs.exists }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
token: "${{ github.token }}" | |
- name: Output current version | |
id: output_version | |
run: | | |
VERSION=$(make version) | |
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Check if current version exists as tag | |
uses: mukunku/[email protected] | |
id: check-tag | |
with: | |
tag: v${{ steps.output_version.outputs.version }} | |
repo: ${{ github.repository }} | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- info | |
if: needs.info.outputs.exists == 'false' | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
token: "${{ github.token }}" | |
- name: Fetch history | |
run: git fetch --prune --unshallow | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Build release artifacts | |
run: | | |
make build | |
- name: Create a new GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Release v${{ needs.info.outputs.version }} | |
tag_name: v${{ needs.info.outputs.version }} | |
generate_release_notes: true | |
files: | | |
README.md | |
LICENSE | |
dist/*.tar.gz | |
token: ${{ secrets.GITHUB_TOKEN }} |