fix(deps): update go #218
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: push container image | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
workflow_dispatch: {} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- uses: ko-build/setup-ko@v0.7 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
- run: ko publish --bare --tags "${{ steps.meta.outputs.tags }},latest" ./cmd/prel | |
- name: Update Release Body | |
# when ref is a tag, github.ref is like refs/tags/v1.0.0 | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
RELEASE_ID="${{ github.ref }}" | |
RELEASE_ID="${RELEASE_ID#refs/tags/}" | |
IMAGE="ghcr.io/lirlia/prel:${RELEASE_ID}" | |
gh release view ${RELEASE_ID} --json body -q '.body' > note.md | |
cat << EOF > note.md | |
$(cat note.md) | |
## Container Image | |
\`\`\`bash | |
docker pull ${IMAGE} | |
\`\`\` | |
EOF | |
gh release edit "$RELEASE_ID" --notes-file note.md | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |