Nightly build of develop #1277
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
# This is a basic workflow to help you get started with Actions | |
name: Nightly build of develop | |
on: | |
schedule: | |
- cron: 0 4 * * * | |
workflow_dispatch: | |
inputs: | |
jobs: | |
check: | |
name: Check and Trigger the "Build/ Publish" Action | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
uploadURL: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
ref: develop | |
# Create Tag by https://stackoverflow.com/a/64970393 | |
- name: Checkout nightly build-repo # only in the nightly build trigger action | |
uses: actions/checkout@v2 | |
with: | |
repository: negue/meme-box-nightly | |
path: nightly_repo | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo: | |
token: ${{ secrets.NIGHTLY_TOKEN }} | |
- name: get last commit # only in the nightly build trigger action | |
id: get-last-commit | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: 'nightly_repo/last_commit.json' | |
prop_path: 'COMMIT' | |
- run: echo ${{steps.format_script.outputs.prop}} | |
- name: Get current date | |
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- name: Declare some variables # needed ? | |
id: vars | |
shell: bash | |
run: | | |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
echo "::set-output name=TAG_NAME::nightly${date}" # only in the nightly build trigger action | |
echo "::set-output name=RELEASE_NAME::nightly-release-${date}" # only in the nightly build trigger action | |
- name: Create last_commit.json | |
uses: schdck/create-env-json@v1 | |
id: create-last-commit | |
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }} | |
with: | |
file-name: './nightly_repo/last_commit.json' | |
VERSION_TAG: ${{ steps.vars.outputs.TAG_NAME }} | |
COMMIT: ${{ steps.vars.outputs.sha_short }} | |
- name: Create tag in public repository | |
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }} | |
run: | | |
cd ${{github.workspace}}/nightly_repo | |
git tag ${{ steps.vars.outputs.TAG_NAME }} | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }} | |
with: | |
commit_message: Commit last_commit.json | |
repository: nightly_repo | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }} | |
with: | |
github_token: ${{ secrets.NIGHTLY_TOKEN }} | |
branch: main | |
directory: nightly_repo | |
tags: true | |
repository: negue/meme-box-nightly | |
- name: Invoke workflow "build_and_publish" with inputs | |
uses: benc-uk/workflow-dispatch@v1 | |
if: ${{steps.get-last-commit.outputs.prop != steps.vars.outputs.sha_short }} | |
with: | |
workflow: Build & Publish to Repo | |
token: ${{ secrets.NIGHTLY_TOKEN }} | |
ref: ${{ steps.vars.outputs.branch }} | |
inputs: | | |
{ | |
"nightly": "true", | |
"tag-name": "${{ steps.vars.outputs.TAG_NAME }}", | |
"commitish": "main", | |
"release-name": "${{ steps.vars.outputs.RELEASE_NAME }}", | |
"pre-release": "true", | |
"draft": "false" | |
} |