run auto_sst #217
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: run auto_sst | |
on: | |
schedule: | |
- cron: '0 14 * * *' # 1600 SAST | |
workflow_dispatch: # Optional, if you still want manual triggering with other inputs | |
inputs: | |
build_image: | |
description: 'build the docker image as part of the workflow?' | |
required: true | |
default: 'true' | |
type: boolean | |
jobs: | |
build_image: | |
if: ${{ github.event.schedule || github.event.inputs.build_image == 'true' }} # Conditional execution (saves time when testing something else and we don't want to build it every time) | |
uses: ./.github/workflows/build_image.yml # Path to your reusable workflow | |
# Set the environment variables | |
envs: | |
runs-on: ubuntu-latest | |
outputs: | |
BRANCH_REF: ${{ steps.BRANCH_REF.outputs.value }} | |
steps: | |
- name: Set the BRANCH_REF | |
id: BRANCH_REF | |
run: | | |
echo "value=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
run-script: | |
needs: [envs,build_image] | |
if: ${{ always() }} # Always run even if build_image is not executed (but it'll wait for build_image if it is) | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_REF: ${{ needs.envs.outputs.BRANCH_REF }} | |
steps: | |
- name: run the script | |
run: >- | |
docker run \ | |
--rm \ | |
-v ${{ github.workspace }}:/tmp \ | |
ghcr.io/saeon/auto_sst_${{ env.BRANCH_REF }}:latest \ | |
${{ secrets.COPERNICUS_USERNAME }} \ | |
${{ secrets.COPERNICUS_PASSWORD }} \ | |
${{ secrets.EMAIL_SENDER }} \ | |
${{ secrets.EMAIL_PASSWORD }} | |