Skip to content

Pass version to changelog step. #12

Pass version to changelog step.

Pass version to changelog step. #12

Workflow file for this run

name: Release
on:
push:
tags: ["*"]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: write
id-token: write
packages: write
jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get tag or version
id: gitvars
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: Collect changelog
id: changelog
uses: saadmk11/[email protected]
with:
release_version: ${{ steps.gitvars.outputs.version }}
- name: Create a Github release
uses: taiki-e/create-gh-release-action@v1
id: release
with:
allow-missing-changelog: true
changelog: "${{ steps.changelog.outputs.changelog }}"
token: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release ${{ matrix.target }}
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-gnu
archive: zip
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
archive: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
archive: zip
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compile and release
uses: taiki-e/upload-rust-binary-action@v1
with:
bin: leaveme
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}
container:
name: Build Docker image
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: v2.1.1
- name: Setup Docker buildx
uses: docker/[email protected]
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
tags: |
type=raw,value=${{ needs.create-release.outputs.version }}
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: 'true'
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max=