fix: rename pull request workflow #84
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 | |
on: | |
push: | |
branches: ["main"] | |
tags: ["v*"] | |
jobs: | |
lint: | |
uses: "./.github/workflows/_lint.yml" | |
build: | |
uses: "./.github/workflows/_build.yml" | |
publish-image: | |
name: Publish Docker Image | |
needs: ["lint", "build"] | |
runs-on: ubuntu-latest | |
env: | |
# Set CALCULATED_IMAGE_TAG to "latest" or "vX.Y.Z" | |
CALCULATED_IMAGE_TAG: "${{ github.ref == 'refs/heads/main' && 'latest' || github.ref_name }}" | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
# QEMU is required for building multi-arch images | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Remove 'v' From SemVer Tags | |
run: | | |
export CALCULATED_TAG=$(echo ${{ env.CALCULATED_IMAGE_TAG }} | sed 's/^v//g') | |
echo "Calculated image tag is $CALCULATED_TAG" | |
echo "CALCULATED_IMAGE_TAG=$CALCULATED_TAG" >> "$GITHUB_ENV" | |
- name: Build and Publish Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
# NB: make sure to adjust the _build.yml workflow when adding new platforms | |
# NB: arm/v7 support currently blocked by https://gitlab.com/qemu-project/qemu/-/issues/1729 | |
# (see https://github.com/docker/build-push-action/issues/977) | |
platforms: "linux/arm64,linux/amd64" | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ env.CALCULATED_IMAGE_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
publish-github-release: | |
name: Publish GitHub Release w/ Changelog | |
needs: ["publish-image"] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
# Only run when a tag named vX.Y.Z is pushed | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
# LinkFix vX.Y.Z | |
name: LinkFix ${{ github.ref_name }} | |
body: |+ | |
## LinkFix was updated! | |
You can find the latest Docker images on the [packages page](https://github.com/podaboutlist/linkfix-for-discord/pkgs/container/linkfix-for-discord). | |
# TODO: Change this to `false` once we're happy with the generation | |
draft: false | |
# See .github/release for generation parameters | |
generate_release_notes: true |