CI/CD promote #104
Workflow file for this run
This file contains hidden or 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: "CI/CD promote" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to promote to' | |
| type: environment | |
| required: true | |
| env: | |
| AWS_REGION: eu-west-2 | |
| AWS_S3_SOURCE_RELEASES_BUCKET: vita-${{ secrets.PROMOTE_SOURCE_AWS_ACCOUNT_ID }}-releases-${{ vars.PROMOTE_SOURCE_ENVIRONMENT }} | |
| AWS_S3_TARGET_RELEASES_BUCKET: vita-${{ secrets.AWS_ACCOUNT_ID }}-releases-${{ github.event.inputs.environment }} | |
| jobs: | |
| metadata: | |
| name: "Set CI/CD metadata" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 1 | |
| outputs: | |
| build_datetime: ${{ steps.variables.outputs.build_datetime }} | |
| build_timestamp: ${{ steps.variables.outputs.build_timestamp }} | |
| build_epoch: ${{ steps.variables.outputs.build_epoch }} | |
| version: ${{ steps.variables.outputs.version }} | |
| release_tag: ${{ steps.variables.outputs.release_tag }} | |
| steps: | |
| - name: "Check ref" | |
| run: | | |
| if ${{ !startsWith(github.ref, 'refs/tags/') }}; then | |
| echo "❌ Only tagged promotions allowed." | |
| exit 1 | |
| fi | |
| - name: "Checkout code" | |
| uses: actions/checkout@v5 | |
| - name: "Set CI/CD variables" | |
| id: variables | |
| run: | | |
| datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z') | |
| echo "build_datetime=$datetime" >> $GITHUB_OUTPUT | |
| echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
| echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT | |
| # TODO: Get the version, but it may not be the .version file as this should come from the CI/CD Pull Request Workflow | |
| echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT | |
| echo "release_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| - name: "List variables" | |
| run: | | |
| export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}" | |
| export BUILD_TIMESTAMP="${{ steps.variables.outputs.build_timestamp }}" | |
| export BUILD_EPOCH="${{ steps.variables.outputs.build_epoch }}" | |
| export VERSION="${{ steps.variables.outputs.version }}" | |
| export RELEASE_TAG="${{ steps.variables.outputs.release_tag }}" | |
| make list-variables | |
| promote-stage: | |
| name: "Promote stage" | |
| needs: [metadata] | |
| uses: ./.github/workflows/stage-6-promote.yaml | |
| with: | |
| environment: ${{ inputs.environment }} | |
| release_tag: ${{ needs.metadata.outputs.release_tag }} | |
| secrets: inherit |