v3.0.0 #11
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: | |
release: | |
types: | |
- released | |
jobs: | |
build-assets: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
include: | |
- os: ubuntu-latest | |
platform_alias: linux | |
- os: windows-latest | |
platform_alias: win32 | |
name: Build on ${{ matrix.os }} and upload release assets | |
runs-on: ${{ matrix.os }} | |
env: | |
RELEASE_TAG: ${{ github.event.release.tag_name }} | |
steps: | |
# Checkout repo | |
- uses: actions/checkout@v4 | |
# Setup Node.js | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# Install npm deps | |
- name: Install npm dependencies | |
run: npm install --no-audit | |
# Build Vue frontend | |
- name: Build frontend | |
run: npm run build | |
# Set up Rust and Cargo | |
- name: Set up Rust toolchain | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: 1.77.2 | |
# Build app | |
- name: Build backend | |
run: cargo build-${{ matrix.platform_alias }} | |
# Package app for release | |
- name: Package app | |
run: cargo pack-${{ matrix.platform_alias }} --tag ${{ env.RELEASE_TAG }} | |
# Create Windows installer | |
- if: matrix.os == 'windows-latest' | |
name: Create Windows installer | |
shell: bash | |
run: | | |
cargo install cargo-packager --version 0.8.1 --locked | |
cargo create-installer-win32 | |
rm -rf ./package/artifacts/.cargo-packager || true | |
# Upload release assets | |
- name: Upload assets to release ${{ github.event.release.tag_name }} | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
./package/artifacts/* | |
# Upload Linux build to artifacts | |
- if: matrix.os == 'ubuntu-latest' | |
name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-assets | |
path: package/linux/ | |
docker-publish: | |
name: Publish image to Docker Hub | |
needs: build-assets | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_TAG: ${{ github.event.release.tag_name }} | |
DOCKER_REPO: m4heshd/ufc-ripper | |
steps: | |
# Checkout repo | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Download Linux build artifacts | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: linux-assets | |
path: package/linux/ | |
# Set up QEMU | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Set up Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Authenticate Docker Hub | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Build docker image and push to Docker Hub repo | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
${{ env.DOCKER_REPO }}:${{ github.event.release.tag_name }} | |
${{ env.DOCKER_REPO }}:latest | |
# Update Docker Hub repo description | |
- name: Update repo description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: ${{ env.DOCKER_REPO }} | |
readme-filepath: ./docker/README.md | |
short-description: ${{ github.event.repository.description }} |