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
name: Release
on:
workflow_dispatch:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
permissions:
contents: write
jobs:
build:
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
runs-on: macos-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate version
id: version
run: |
CALVER=$(date -u +"%Y-%m-%d")
SHORT_SHA=$(git rev-parse --short HEAD)
echo "version=${CALVER}+${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Build
run: |
PINCH_VERSION="${{ steps.version.outputs.version }}" cargo build --release
tar -czf pinch-aarch64-apple-darwin.tar.gz -C target/release pinch
- name: Publish
run: |
VERSION="${{ steps.version.outputs.version }}"
git tag "v${VERSION}"
git push origin "v${VERSION}"
gh release create "v${VERSION}" \
--title "v${VERSION}" \
--generate-notes \
pinch-aarch64-apple-darwin.tar.gz
env:
GH_TOKEN: ${{ github.token }}
dotslash:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate DotSlash file
uses: facebook/dotslash-publish-release@v1
with:
config: .github/dotslash-config.json
tag: v${{ needs.build.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}