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
# Souped up with the arm/msvc builds from: https://github.com/capeprivacy/nitrogen/blob/main/.github/workflows/release.yaml
name: Release
on:
release:
types:
workflow_dispatch:
jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: tar.gz
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz
- target: x86_64-apple-darwin
archive: tar.gz
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/rust-build.action@v1.3.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
TOOLCHAIN_VERSION: 1.72.0
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: Binary
# path: |
# ${{ steps.compile.outputs.BUILT_ARCHIVE }}
# ${{ steps.compile.outputs.BUILT_CHECKSUM }}
# windows-msvc-release:
# name: release windows msvc
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@master
# - name: Build
# run: |
# cargo build --release
# - name: tar
# run: tar --directory=target/release -cf archive.tar.gz courses.exe
# - name: upload
# run: |
# $id = gh api -H "Accept: application/vnd.github+json" /repos/coursesproject/courses/releases/tags/${{ github.ref_name }} --jq .id
# curl --fail-with-body -sS -X POST --data-binary "@archive.tar.gz" -H 'Content-Type: application/octet-stream' -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "https://uploads.github.com/repos/coursesproject/courses/releases/$id/assets?name=courses_${{ github.ref_name }}_x86_64-pc-windows-msvc.tar.gz"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# macos-arm-release:
# name: release mac os arm release
# runs-on: macos-12
# steps:
# - uses: actions/checkout@master
# - name: check toolchain
# run: rustup default
# - name: Build
# run: |
# rustup toolchain install stable-aarch64-apple-darwin
# rustup target add aarch64-apple-darwin
# cargo build --release --target aarch64-apple-darwin
# - name: tar
# run: tar --directory=target/aarch64-apple-darwin/release -cf archive.tar.gz courses
# - name: upload
# run: |
# id=$(gh api -H "Accept: application/vnd.github+json" /repos/coursesproject/courses/releases/tags/${{ github.ref_name }} --jq .id)
# curl --fail-with-body -sS -X POST --data-binary @"archive.tar.gz" -H 'Content-Type: application/octet-stream' -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://uploads.github.com/repos/coursesproject/courses/releases/$id/assets?name=courses_${{ github.ref_name }}_aarch64-apple-darwin.tar.gz"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}