-
Notifications
You must be signed in to change notification settings - Fork 28
92 lines (85 loc) · 2.7 KB
/
release.yaml
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
---
on:
release:
types: [published]
name: release
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
- uses: nixbuild/nix-quick-install-action@v22
with:
nix_version: 2.14.1
nix_conf: |
experimental-features = nix-command flakes
sandbox = false
substituters = https://cache.nixos.org/?priority=40
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
builders-use-substitutes = true
extra-platforms = aarch64-linux
- name: Cache nix store
uses: actions/cache@v3
with:
path: /nix
key: nix-build-${{ hashFiles('flake.nix', 'flake.lock', '**.nix') }}
- name: place let's encrypt cert
run: |
cat <<EOF > ssl/.ssl/fullchain.pem
${{ secrets.CERT_FULL_CHAIN }}
EOF
cat <<EOF > ssl/.ssl/privkey.pem
${{ secrets.CERT_PRIV_KEY }}
EOF
shell: bash
- name: "Build artifact"
run: |
export GORELEASER_CURRENT_TAG=${{ steps.vars.outputs.VERSION }}
nix develop .\#cibuild -c goreleaser release --skip-validate
- name: Upload assets
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload --clobber "${{ github.ref_name }}" ./dist/*.tar.gz ./dist/checksums.txt
update-releases-file:
name: Update Releases File
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3.5.0
with:
ref: gh-pages
- name: Generate releases.json
shell: bash
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh api repos/nhost/cli/releases > releases.json
- name: Check if there are changes
id: changes
shell: bash
run: |
if [[ -z "$(git status --porcelain . )" ]]; then
echo "::set-output name=changed::0"
else
echo "::set-output name=changed::1"
fi
- name: Committing releases.json
shell: bash
if: steps.changes.outputs.changed == 1
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "" --allow-empty-message
- name: Push changes
uses: ad-m/github-push-action@master
if: steps.changes.outputs.changed == 1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true