Fix issues with cross-compilation. #13
Workflow file for this run
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: | |
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: Set Perl environment variables | |
run: | | |
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
if: startsWith(matrix.os, 'windows') | |
- name: Install cross-compilation tools | |
uses: taiki-e/setup-cross-toolchain-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
if: startsWith(matrix.os, 'ubuntu') | |
- 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= |