CICD Pipeline #3
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: CICD Pipeline | ||
#TODO This has the "testing" environment hard coded so this will need to be augmented. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
img_tag: | ||
description: Docker Image Tag | ||
ref: | ||
description: Revision or Branch to build | ||
default: main | ||
push_latest: | ||
description: Set True if the build is for the latest version | ||
type: boolean | ||
required: false | ||
default: false | ||
platforms: | ||
description: Platforms to build for | ||
type: choice | ||
default: linux/amd64,linux/arm64 | ||
options: | ||
- linux/amd64,linux/arm64 | ||
- linux/amd64 | ||
- linux/arm64 | ||
environments: | ||
description: The environment to deploy to | ||
type: choice | ||
default: testing | ||
options: | ||
- testing | ||
- staging | ||
- production | ||
rebuild: | ||
description: Rebuild this image? | ||
type: boolean | ||
default: false | ||
jobs: | ||
test-code: | ||
#TODO: Use Coveralls? | ||
name: Run test for branch | ||
uses: ./.github/workflows/test-code.yml | ||
with: | ||
ref: ${{inputs.ref}} | ||
build-image: | ||
runs-on: ubuntu-latest | ||
needs: test-code | ||
permissions: | ||
contents: read | ||
packages: write | ||
outputs: | ||
ghc_img: ${{ steps.image.outputs.ghc_img }} | ||
steps: | ||
- name: Build Image | ||
uses: hathitrust/github_actions/build@v1 | ||
id: image | ||
with: | ||
image: ghcr.io/${{ github.repository }} | ||
dockerfile: Dockerfile | ||
img_tag: ${{ inputs.img_tag }} | ||
tag: ${{ inputs.ref }} | ||
push_latest: ${{ inputs.push_latest}} | ||
registry_token: ${{ github.token }} | ||
rebuild: ${{ inputs.rebuild }} | ||
test-image: | ||
uses: ./.github/workflows/test-image.yml | ||
with: | ||
ref: ${{inputs.ref}} | ||
ghc_img: ${{ needs.build-image.outputs.ghc_img }} | ||
Check failure on line 70 in .github/workflows/cicd-pipeline.yml GitHub Actions / CICD PipelineInvalid workflow file
|
||
deploy: | ||
needs: [build-image, test-image] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
#TODO: Think about workflow with creating a release | ||
- name: Deploy to ${{inputs.environments}} | ||
uses: hathitrust/github_actions/deploy@v1 | ||
with: | ||
image: ${{ needs.build-image.outputs.ghc_img }} | ||
file: environments/${{ github.event.repository.name }}/${{inputs.environments}}/web-image.txt | ||
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }} | ||
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }} | ||
CONFIG_REPO_RW_KEY: ${{secrets.CONFIG_REPO_RW_KEY}} |