-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (76 loc) · 2.42 KB
/
pre-release.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
name: Publish pre-release package
# This workflow will publish a release every night if changes have been made.
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
concurrency:
group: "pre-release"
cancel-in-progress: true
env:
PANTS_PANTSD: False
jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit is less than 24h old
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
# https://github.com/orgs/community/discussions/27128
steps:
- uses: actions/checkout@v2
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: |
if test -z $(git rev-list --after="24 hours" ${{ github.sha }}); then
"should_run=true" >> $GITHUB_OUTPUT
fi
pre_release:
name: "Pre Release"
runs-on: "ubuntu-latest"
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
with:
# cache0 makes it easy to bust the cache if needed
gha-cache-key: cache0-py3.8
named-caches-hash: ${{ hashFiles('pants-plugins/lock.txt') }}
- name: Build Packages
run: "pants package //pants-plugins::"
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: latest
assets: 'pants*'
- name: Update tag
uses: richardsimko/update-tag@v1
with:
tag_name: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Build Changelog"
id: github_release
uses: mikepenz/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
toTag: ${{ github.ref }}
configuration: .github/workflows/changelog.json
- name: Create Release
uses: mikepenz/[email protected]
with:
body: ${{ steps.github_release.outputs.changelog }}
prerelease: true
title: "Nightly release"
tag_name: "latest"
files: |
dist/pants*
LICENSE-*