This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
133 lines (128 loc) · 4.19 KB
/
ci.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
pull_request: {}
push:
branches: [main]
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Check out code (full depth for tags)
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: caching deps
run: make deps
# this version will be a git describe-tags output, so if the commit is the most recent tag
# it will BE the tag, or will be of the form `v0.1.0-N-aabbccdd`. We then append to it
# `-$1-$kernel-$arch`.
- name: outputting version
run: ./_build/write-version.bash gha > version.ts
- name: running tests
run: make test
- name: compiling executable for x86_64-unknown-linux-gnu
run: make build-linux-x86_64
- name: compiling executable for x86_64-apple-darwin
run: make build-macos-x86_64
- name: compiling executable for aarch64-apple-darwin
run: make build-macos-aarch64
- name: compiling executable for x86_64-pc-windows-msvc
run: make build-windows-x86_64
- name: setting chmod
run: chmod +x /tmp/render-*
- name: test-running linux artifact just to be sure...
run: /tmp/render-linux-x86_64 version
- name: uploading artifacts (all)
uses: actions/upload-artifact@v2
# if: startsWith(github.ref, 'refs/tags/')
with:
name: render-binaries
path: /tmp/render-*
make-nupkg:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
# we need to remove the 'v' from this, choco doesn't like it
- name: Check out code
uses: actions/checkout@v2
- name: Create temp directories
run:
mkdir -p ./tmp/artifacts ./tmp/nupkg
- uses: actions/download-artifact@v3
with:
name: render-binaries
path: ./tmp/artifacts
- name: Prep executable
run: cp ./tmp/artifacts/render-windows-x86_64.exe ./tmp/nupkg/render.exe
- name: copy tools to nupkg
run:
cp -r ./_build/nupkg/tools ./tmp/nupkg/tools
- name: output templated nuspec
run:
cat ./_build/nupkg/rendercli.nuspec.template | sed "s/NUSPEC_PACKAGE_VERSION/${GITHUB_REF/refs\/tags\/v/}/g" > ./tmp/nupkg/rendercli.nuspec
- name: show templated nuspec
run: cat ./tmp/nupkg/rendercli.nuspec
- name: enumerating nupkg files
run: find ./tmp/nupkg
- name: pack nupkg
uses: crazy-max/ghaction-chocolatey@v2
with:
args: pack ./tmp/nupkg/rendercli.nuspec
- name: check for nupkg
run: ls . && find ./tmp
- name: uploading nupkg
uses: actions/upload-artifact@v2
# if: startsWith(github.ref, 'refs/tags/')
with:
name: nupkg
path: ./rendercli.*.nupkg
make-release:
runs-on: ubuntu-latest
needs:
- build
- make-nupkg
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out code
uses: actions/checkout@v2
- run: mkdir -p /tmp/artifacts /tmp/nupkg
- uses: actions/download-artifact@v3
with:
name: render-binaries
path: /tmp/artifacts
- uses: actions/download-artifact@v3
with:
name: nupkg
path: /tmp/nupkg
- name: Do GitHub release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
/tmp/artifacts/*
/tmp/nupkg/*
LICENSE
README.md
push-nupkg:
runs-on: ubuntu-latest
needs:
- make-release
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: nupkg
path: ./tmp/nupkg
- name: rename nupkg for action
run: cp ./tmp/nupkg/rendercli.${GITHUB_REF/refs\/tags\/v/}.nupkg ./tmp/nupkg/rendercli.nupkg
- name: "push nupkg to chocolatey"
uses: crazy-max/ghaction-chocolatey@v2
with:
args: push --key ${{ secrets.CHOCOLATEY_APIKEY }} --source https://push.chocolatey.org ./tmp/nupkg/rendercli.nupkg
permissions:
contents: write