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
name: Release
on:
workflow_dispatch:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
permissions: {}
env:
# workflow_run checks out the default branch head by default, which may have
# moved past the commit CI actually validated.
RELEASE_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}
jobs:
version:
if: >-
github.event_name == 'workflow_dispatch'
|| github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Calculate version
id: version
run: |
CALVER=$(date -u +"%Y-%m-%d")
echo "version=${CALVER}+${RELEASE_SHA::7}" >> "$GITHUB_OUTPUT"
build:
needs: version
strategy:
matrix:
include:
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-gnu }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_SHA }}
persist-credentials: false
- name: Build
run: |
rustup target add "${TARGET}"
JEANS_VERSION="${VERSION}" cargo build --release -p jeans --target "${TARGET}"
tar -czf "jeans-${TARGET}.tar.gz" -C "target/${TARGET}/release" jeans
env:
TARGET: ${{ matrix.target }}
VERSION: ${{ needs.version.outputs.version }}
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: jeans-${{ matrix.target }}
path: jeans-${{ matrix.target }}.tar.gz
publish:
needs: [version, build]
runs-on: ubuntu-latest
permissions:
contents: write # create GitHub release
outputs:
version: ${{ needs.version.outputs.version }}
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: jeans-*
merge-multiple: true
- name: Publish
run: |
gh release create "v${VERSION}" \
--repo "${GITHUB_REPOSITORY}" \
--title "v${VERSION}" \
--generate-notes \
--target "${RELEASE_SHA}" \
jeans-*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ needs.version.outputs.version }}
dotslash:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write # upload release assets
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.RELEASE_SHA }}
persist-credentials: false
- name: Generate DotSlash file
uses: facebook/dotslash-publish-release@9c9ec027515c34db9282a09a25a9cab5880b2c52 # v2
with:
config: .github/dotslash-config.json
tag: v${{ needs.publish.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}