-
Notifications
You must be signed in to change notification settings - Fork 71
83 lines (80 loc) · 3.6 KB
/
nightly.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
on:
workflow_dispatch:
name: Nightly Release
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Delete existing release
uses: actions/github-script@v3
with:
debug: true
script: |
const existingRelease = await github.repos.getReleaseByTag({owner:"twitchdev", repo:"twitch-cli", tag:"Nightly"})
if (!existingRelease) {return}
console.log(existingRelease.data)
await github.repos.deleteRelease({owner:"twitchdev", repo:"twitch-cli", release_id:existingRelease.data.id})
- name: Checkout
uses: actions/checkout@v2
- name: Build with xgo
uses: crazy-max/ghaction-xgo@v1
with:
dest: build
targets: windows/amd64,linux/amd64,darwin/amd64
v: true
ldflags: -s -w -X main.buildVersion=nightly
buildmode: default
prefix: twitch
- run: mv build/twitch-windows* build/twitch-windows.exe
- run: mv build/twitch-darwin* build/twitch-macos
- run: mv build/twitch-linux* build/twitch-linux
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Update Nightly Tag
uses: richardsimko/update-tag@v1
with:
tag_name: Nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: Nightly
release_name: Nightly Release - ${{ env.DATE }}
draft: false
prerelease: true
- name: Upload Windows Asset
id: upload-release-asset-win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./build/twitch-windows.exe
asset_name: twitch-windows.exe
asset_content_type: application/x-dosexec
- name: Upload MacOS Asset
id: upload-release-asset-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./build/twitch-macos
asset_name: twitch-macos
asset_content_type: application/x-mach-binary
- name: Upload Linux Asset
id: upload-release-asset-linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./build/twitch-linux
asset_name: twitch-linux
asset_content_type: application/x-executable