chore: release v0.3.1 #174
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: | |
branches: | |
- "main" | |
tags: | |
- "v*" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
# https://github.com/Mozilla-Actions/sccache-action#rust-code | |
# RUSTC_WRAPPER: "sccache" | |
# SCCACHE_GHA_ENABLED: "true" | |
jobs: | |
build: | |
if: "startsWith(github.ref, 'refs/tags/v') || !contains(github.event.head_commit.message, 'chore: release')" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
command: _build | |
musl: false | |
- target: x86_64-unknown-linux-musl | |
command: _build | |
musl: true | |
- target: aarch64-unknown-linux-gnu | |
command: _zigbuild | |
musl: false | |
- target: aarch64-unknown-linux-musl | |
command: _zigbuild | |
musl: true | |
name: build ${{ matrix.target }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: dtolnay/rust-toolchain@nightly | |
- uses: taiki-e/install-action@just | |
# - uses: mozilla-actions/sccache-action@v0.0.3 | |
- if: matrix.command == '_zigbuild' | |
uses: mlugg/setup-zig@v1 | |
- if: matrix.musl == true | |
run: sudo apt update && sudo apt install -y musl-tools && sudo ln -s /bin/g++ /bin/musl-g++ | |
- run: just ${{ matrix.command }} ${{ matrix.target }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: hatsu.${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/hatsu | |
if-no-files-found: error | |
retention-days: 30 | |
- if: startsWith(github.ref, 'refs/tags/v') | |
uses: TheDoctor0/zip-release@0.7.6 | |
with: | |
type: tar | |
filename: hatsu.${{ matrix.target }}.tar | |
directory: target/${{ matrix.target }}/release/ | |
path: hatsu | |
- if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
prerelease: ${{ contains(github.ref, '-') }} | |
files: target/${{ matrix.target }}/release/hatsu.${{ matrix.target }}.tar | |
docker: | |
name: docker buildx | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: hatsu.x86_64-unknown-linux-gnu | |
path: target_amd64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: hatsu.aarch64-unknown-linux-gnu | |
path: target_arm64 | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }} | |
flavor: | | |
latest=false | |
labels: | | |
org.opencontainers.image.title=Hatsu | |
org.opencontainers.image.description=Self-hosted & Fully-automated ActivityPub Bridge for Static Sites. | |
# https://github.com/docker/metadata-action#major-version-zero | |
tags: | | |
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') && !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }} | |
type=raw,value=beta,enable=${{ startsWith(github.ref, 'refs/tags/v') }} | |
type=raw,value=nightly | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |