-
Notifications
You must be signed in to change notification settings - Fork 171
96 lines (80 loc) · 2.71 KB
/
release.yml
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
name: Release
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Create and upload release tarballs
if: github.event.base_ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v20
- name: Prepare metadata
id: metadata
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TARBALL=futhark-${GITHUB_REF#refs/tags/v}-linux-x86_64.tar.xz" >> $GITHUB_OUTPUT
- name: Build tarball
env:
VERSION: ${{ steps.metadata.outputs.VERSION }}
run: nix-build --argstr suffix $VERSION-linux-x86_64 --argstr commit $GITHUB_SHA
- name: Extract release changes
env:
VERSION: ${{ steps.metadata.outputs.VERSION }}
run:
sh tools/changelog.sh $VERSION < CHANGELOG.md > release_changes.md
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.metadata.outputs.VERSION }}
body_path: release_changes.md
draft: false
prerelease: false
- name: Upload tarball
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: result/${{ steps.metadata.outputs.TARBALL }}
asset_name: ${{ steps.metadata.outputs.TARBALL }}
asset_content_type: application/x-xz
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSHKEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: scp to server
env:
TARBALL: ${{ steps.metadata.outputs.TARBALL }}
run: scp -o StrictHostKeyChecking=no result/$TARBALL [email protected]:/var/www/htdocs/futhark-lang.org/releases
upload-to-hackage:
name: Upload to Hackage
if: github.event.base_ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v20
- uses: cachix/cachix-action@v12
with:
name: futhark
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Upload to Hackage
run: |
export HACKAGE_KEY
export VERSION
nix-shell --run 'cabal update'
nix-shell --run tools/release/hackage.sh
env:
HACKAGE_KEY: ${{ secrets.HACKAGE_KEY }}
VERSION: ${{ steps.metadata.outputs.VERSION }}