-
-
Notifications
You must be signed in to change notification settings - Fork 4
118 lines (115 loc) · 3.6 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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.81.0
# 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 }}