-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (100 loc) · 4.4 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Go version to build ("1.21")'
required: true
prerelease:
description: 'Is this a pre-release?'
required: true
default: 'false'
jobs:
build:
strategy:
matrix:
include:
- builder: macos-latest
goos: darwin
goarch: arm64
- builder: macos-latest
goos: darwin
goarch: amd64
- builder: ubuntu-20.04
goos: linux
goarch: amd64
- builder: ubuntu-20.04
goos: linux
goarch: arm64
- builder: windows-latest
goos: windows
goarch: amd64
runs-on: ${{ matrix.builder }}
outputs:
built_version: ${{ steps.encore_go_version.outputs.version }}
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need the full history for the Go submodule
submodules: true # Checkout the Go submodule
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.20'
- name: 'Create patched runtime'
run: bash ./apply_patch.bash "${{ github.event.inputs.version }}"
- name: Build
run: go run . -dst=dist -goos=${{ matrix.goos }} -goarch=${{ matrix.goarch }}
env:
GO111MODULE: "on"
# This step gets the exact version of Go we're releasing (including minor), so if we give the input as `1.17` this might return `encore-go1.17.5`.
- name: 'Read the version of Go we built'
id: encore_go_version
run: echo "::set-output name=version::$(go run . --read-built-version)"
- name: 'Tar artifacts'
run: tar -czvf ${{ steps.encore_go_version.outputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz -C dist/${{ matrix.goos }}_${{ matrix.goarch }} .
- name: 'Upload build artifact'
uses: actions/upload-artifact@v2
with:
name: ${{ steps.encore_go_version.outputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}
path: ${{ steps.encore_go_version.outputs.version }}-${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz
release:
runs-on: ubuntu-20.04
needs: build
steps:
- name: 'Download artifacts from build steps'
uses: actions/download-artifact@v2
- name: 'Convert windows artifact to zip'
run: |
cd ${{needs.build.outputs.built_version}}-windows_amd64
tar -xzf ${{needs.build.outputs.built_version}}-windows_amd64.tar.gz
zip -r ${{needs.build.outputs.built_version}}-windows_amd64.zip encore-go
- name: 'Move, rename and create checksums for the artifacts'
run: |
mkdir output
mv ${{needs.build.outputs.built_version}}-linux_amd64/${{needs.build.outputs.built_version}}-linux_amd64.tar.gz output/linux_x86-64.tar.gz
mv ${{needs.build.outputs.built_version}}-linux_arm64/${{needs.build.outputs.built_version}}-linux_arm64.tar.gz output/linux_arm64.tar.gz
mv ${{needs.build.outputs.built_version}}-darwin_amd64/${{needs.build.outputs.built_version}}-darwin_amd64.tar.gz output/macos_x86-64.tar.gz
mv ${{needs.build.outputs.built_version}}-darwin_arm64/${{needs.build.outputs.built_version}}-darwin_arm64.tar.gz output/macos_arm64.tar.gz
mv ${{needs.build.outputs.built_version}}-windows_amd64/${{needs.build.outputs.built_version}}-windows_amd64.tar.gz output/windows_x86-64.tar.gz
mv ${{needs.build.outputs.built_version}}-windows_amd64/${{needs.build.outputs.built_version}}-windows_amd64.zip output/windows_x86-64.zip
cd output
sha256sum * > checksums.txt
ls -R .
mv * ../
cd ..
cat checksums.txt
- name: 'Publish release'
uses: DomBlack/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.build.outputs.built_version }}
name: ${{ needs.build.outputs.built_version }}
body: >
This release is the compiled version of ${{ needs.build.outputs.built_version }}
draft: false
allow_override: true
prerelease: ${{ github.event.inputs.prerelease }}
gzip: false
files: linux_x86-64.tar.gz linux_arm64.tar.gz windows_x86-64.tar.gz windows_x86-64.zip macos_arm64.tar.gz macos_x86-64.tar.gz checksums.txt