-
Notifications
You must be signed in to change notification settings - Fork 9
94 lines (81 loc) · 2.78 KB
/
release.yml
File metadata and controls
94 lines (81 loc) · 2.78 KB
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
name: Release
on:
workflow_dispatch:
inputs:
bump:
description: "Semver bump (patch, minor, major)"
required: false
default: "patch"
push:
branches:
- release
jobs:
build-and-release:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Bump version and tag
id: bump
env:
BUMP: ${{ inputs.bump }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
npm version "${BUMP:-patch}" -m "chore: release %s"
VERSION=$(node -p "require('./package.json').version")
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
git push
git push --tags
- name: Build artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run build
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.bump.outputs.version }}
name: Linear v${{ steps.bump.outputs.version }}
draft: false
prerelease: false
files: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Update flake.nix hashes
env:
VERSION: ${{ steps.bump.outputs.version }}
run: |
X86_SRI=$(nix-hash --type sha256 --flat --sri dist/linear-linux-${VERSION}-x86_64.AppImage)
ARM_SRI=$(nix-hash --type sha256 --flat --sri dist/linear-linux-${VERSION}-arm64.AppImage)
sed -i "s|version = \".*\";|version = \"${VERSION}\";|" flake.nix
sed -i "s|hash = \"sha256-.*\"; # x86_64|hash = \"${X86_SRI}\"; # x86_64|" flake.nix
sed -i "s|hash = \"sha256-.*\"; # aarch64|hash = \"${ARM_SRI}\"; # aarch64|" flake.nix
grep -q "${X86_SRI}" flake.nix || { echo "::error::Failed to update x86_64 hash"; exit 1; }
grep -q "${ARM_SRI}" flake.nix || { echo "::error::Failed to update aarch64 hash"; exit 1; }
- name: Commit flake.nix update
env:
VERSION: ${{ steps.bump.outputs.version }}
run: |
git add flake.nix
if git diff --cached --quiet; then
echo "No changes to flake.nix"
else
git commit -m "chore: update flake.nix hashes for v${VERSION}"
git push
fi