release #362
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: release | |
on: | |
create: | |
branches: latest | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
type: boolean | |
tag: | |
type: string | |
required: true | |
schedule: | |
- cron: '00 2 * * *' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
# Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0 | |
node-version: 10.x | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Generate nightly release notes | |
if: github.event_name == 'schedule' | |
id: nightly_relnotes | |
run: | | |
echo "name=relnotes::$(git log --since="24 hours ago" --pretty=format:%s | awk 'NR>1{print "- "$0} NR==1{print "- "$0}')" >> $GITHUB_OUTPUT | |
- name: Setup Python dependencies | |
if: github.event_name != 'schedule' || steps.nightly_relnotes.outputs.relnotes != '' | |
run: | | |
pip3 install mkdocs | |
pip3 install mkdocs-material | |
pip3 install mkdocs-localsearch | |
- name: Build and Archive | |
if: github.event_name != 'schedule' || steps.nightly_relnotes.outputs.relnotes != '' | |
run: | | |
npm install grunt-cli -g | |
npm install . | |
grunt | |
cd build && zip -r ../package.nw . | |
- name: Get Date | |
id: date | |
if: github.event_name != 'schedule' || steps.nightly_relnotes.outputs.relnotes != '' | |
run: echo "name=date::$(date +'%D')" >> $GITHUB_OUTPUT | |
- name: Generate nightly tag | |
if: github.event_name != 'schedule' || steps.nightly_relnotes.outputs.relnotes != '' | |
id: nightly_tag | |
run: | | |
echo "name=tag::nightly_$(date +"%Y.%m.%d")" >> $GITHUB_OUTPUT | |
- name: Tag Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
files: package.nw | |
token: ${{ secrets.CSIDESHELL }} | |
- name: Release Nightly | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'schedule' && steps.nightly_relnotes.outputs.relnotes != '' | |
with: | |
tag_name: ${{ steps.nightly_tag.outputs.tag }} | |
name: 'Nightly Release (${{ steps.date.outputs.date }})' | |
prerelease: true | |
files: package.nw | |
body: <h2>Commit Changelog</h2>${{ steps.nightly_relnotes.outputs.relnotes }} | |
token: ${{ secrets.CSIDESHELL }} | |
- name: Triggered Release | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
name: '${{ github.event.inputs.tag }} Release (${{ steps.date.outputs.date }})' | |
tag_name: ${{ github.event.inputs.tag }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
files: package.nw | |
token: ${{ secrets.CSIDESHELL }} | |