Skip to content

Automatate scoop manifest updates (#534) #54

Automatate scoop manifest updates (#534)

Automatate scoop manifest updates (#534) #54

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: 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: 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@v2
with:
files: '*.tar.gz'
- name: Upload Artifacts
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
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@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
scoop:
name: Update scoop manifest
if: ${{ github.event_name != 'workflow_dispatch' }}
needs: github
runs-on: ubuntu-latest
permissions:
contents: write
env:
TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Update manifest for ${{ env.TAG }}
run: './scripts/update-scoop.rb ./scoop/gengo.json "${TAG}"'
- name: Commit and push changes
run: |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config --global user.name 'github-actions[bot]'
git add ./scoop/gengo.json
git commit -m "Update scoop manifest for ${TAG}"
git push