Publish pre-release package #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Set up Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.8 | |
- name: Tell Pants to use Python 3.8 | |
run: 'echo "PY=python3.8" >> $GITHUB_ENV | |
echo "PANTS_PYTHON_INTERPRETER_CONSTRAINTS=[''==3.8.*'']" >> $GITHUB_ENV | |
' | |
- 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/release-changelog-builder-action@v3.4.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
toTag: ${{ github.ref }} | |
configuration: .github/workflows/changelog.json | |
- name: Create Release | |
uses: mikepenz/action-gh-release@v0.2.0-a03 | |
with: | |
body: ${{ steps.github_release.outputs.changelog }} | |
prerelease: true | |
title: "Nightly release" | |
tag_name: "latest" | |
files: | | |
dist/pants* | |
LICENSE-* |