Skip to content

πŸ”– Release

πŸ”– Release #18

Workflow file for this run

name: Build & release
on:
push:
tags:
- "v*.*.*"
env:
SRC: src/orangutan
BIN: orangutan-server
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Get current tag
id: tag
uses: devops-actions/[email protected]
with:
strip_v: true
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Verify versions
run: rustc --version && rustup --version && cargo --version
- name: Cache build context
id: cache-cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo
build:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
# TODO: Centralize this data
target: [x86_64-unknown-linux-gnu]
env:
tag: ${{ needs.setup.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add Rust target ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Build for ${{ matrix.target }}
working-directory: ${{ env.SRC }}
run: cargo build --release --bin ${{ env.BIN }} --target ${{ matrix.target }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.BIN }}-${{ env.tag }}-${{ matrix.target }}
path: ${{ env.SRC }}/target/${{ matrix.target }}/release/${{ env.BIN }}
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: [setup, build]
env:
#tag: ${{ needs.setup.outputs.tag }}
artifacts: ${{ github.workspace }}/artifacts
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.artifacts }}
- name: Archive artifacts
working-directory: ${{ env.artifacts }}
run: for f in *; do tar -zcvf "$f".tar.gz "$f"; done
- name: Release new version
uses: ncipollo/release-action@v1
with:
#name: ${{ env.tag }}
#body: "⚠️ Changelog not yet provided."
generateReleaseNotes: true
artifactErrorsFailBuild: true
artifacts: ${{ env.artifacts }}/*.tar.gz