Merge pull request #1042 from k1LoW/fix-fail-fast #808
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: tagpr | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tagpr: | |
runs-on: ubuntu-latest | |
outputs: | |
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- id: run-tagpr | |
name: Run tagpr | |
uses: Songmu/tagpr@v1 | |
assets: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
runs-on: macos-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache: true | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dockerimage: | |
needs: tagpr | |
if: needs.tagpr.outputs.tagpr-tag != '' | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get latest version | |
id: latest_version | |
run: | | |
echo -n 'version=' > $GITHUB_OUTPUT | |
gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push (slim) | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile.slim | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }}-slim | |
ghcr.io/k1low/runn:latest-slim | |
labels: | | |
org.opencontainers.image.name=runn | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} | |
org.opencontainers.image.source=https://github.com/k1LoW/runn | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
ghcr.io/k1low/runn:${{ steps.latest_version.outputs.version }} | |
ghcr.io/k1low/runn:latest | |
labels: | | |
org.opencontainers.image.name=runn | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }} | |
org.opencontainers.image.source=https://github.com/k1LoW/runn | |
release: | |
needs: [tagpr, assets, dockerimage] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Release | |
run: | | |
gh api /repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ needs.tagpr.outputs.tagpr-tag }} --jq .body | gh release edit ${{ needs.tagpr.outputs.tagpr-tag }} --repo ${{ github.repository }} --draft=false --latest --notes-file=- | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |