This repository was archived by the owner on Apr 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (67 loc) · 2.48 KB
/
release-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
name: Release nightly snap of upstream project
on:
workflow_dispatch: # Allow manual run
schedule:
- cron: "0 7 * * *" # Every day at 07:00 UTC
permissions:
contents: write
packages: write
issues: write
jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Install Snapcraft in background
run: sudo snap install --no-wait --classic snapcraft
- name: Checkout cli repo
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: cli/cli
- name: Fetch cli tags and set full release name
run: |
git fetch --force --tags
echo "GORELEASER_CURRENT_TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Check for existing release
run: | # https://github.com/actions/runner/issues/662
if ! gh api repos/$GITHUB_REPOSITORY/releases/tags/$(git describe --tags) > /dev/null; then
echo RELEASE=true >> $GITHUB_ENV
echo No release found at $(git describe --tags). Continuing release.
else
echo Existing release found. Cancelling
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout gh-snap repo
if: ${{ env.RELEASE }} # https://github.com/actions/runner/issues/662
uses: actions/checkout@v3
with:
path: snapcrafters
- uses: actions/setup-go@v3
if: ${{ env.RELEASE }}
with:
go-version: '>=1.19.5'
cache: true
- name: Ensure Snapcraft install is completed
if: ${{ env.RELEASE }}
run: snap watch --last=install
- name: Work around pyxdg race condition
if: ${{ env.RELEASE }}
# Relevant bugs and PR:
# https://gitlab.freedesktop.org/xdg/pyxdg/-/merge_requests/14
# https://bugs.launchpad.net/snapcraft/+bug/1889741
# https://github.com/goreleaser/goreleaser/issues/1715
run: |
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- uses: goreleaser/goreleaser-action@v4
if: ${{ env.RELEASE }}
with:
distribution: goreleaser
version: latest
args: release --skip-announce --skip-validate --rm-dist --config snapcrafters/goreleaser-nightly.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.GORELEASER_CURRENT_TAG }}