Skip to content

Release

Release #40

Workflow file for this run

name: Release
on:
push:
tags: ["v*.*.*"]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Publish
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish Library
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p gengo
- name: Publish Binary
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p gengo-bin
github:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Install Linux Dependencies
if: ${{ runner.os == 'Linux' }}
run: sudo apt install -y gcc-aarch64-linux-gnu
- name: Build Assets
run: |
cargo build --release --target ${{ matrix.target }}
tar -C target/${{ matrix.target }}/release/ -czvf gengo-${{ matrix.target }}.tar.gz gengo${{ runner.os == 'Windows' && '.exe' || '' }}
- name: Upload Release Assets
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: softprops/action-gh-release@v1
with:
files: '*.tar.gz'
- name: Upload Artifacts
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v3
with:
path: '*.tar.gz'
docker:
name: Publish Docker Image
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and Publish
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}