From 59b64cb540a84b403d9cd3e1bb42b42e4ea5ed7c Mon Sep 17 00:00:00 2001 From: K'Ron Spar Date: Fri, 20 Dec 2024 11:48:32 -0500 Subject: [PATCH] Added deploy action. Removed usage of `-unstable`. --- .github/workflows/build.yml | 9 ++------- .github/workflows/deploy.yml | 32 ++++++++++++++++++++++++++++++ .github/workflows/tag-release.yaml | 3 +-- 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a72b669..3c9f6c5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,6 @@ name: Build on: - workflow_run: - workflows: ['Run Tests'] - branches: ['main'] - types: [completed] - workflow_dispatch: inputs: img_tag: @@ -40,9 +35,9 @@ jobs: steps: - name: Build Image - uses: hathitrust/github_actions/build@v1.4.0 + uses: hathitrust/github_actions/build@v1 with: - image: ghcr.io/${{ github.repository }}-unstable + image: ghcr.io/${{ github.repository }} dockerfile: Dockerfile img_tag: ${{ inputs.img_tag }} tag: ${{ inputs.ref }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..701a7c74 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,32 @@ +name: Deploy + +on: + workflow_dispatch: + inputs: + branch_hash: + description: Branch hash or revision to deploy + default: main + environments: + description: The environment to deploy to + type: choice + default: testing + options: + - testing + - staging + - production + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Deploy to ${{inputs.environments}} + uses: hathitrust/github_actions/deploy@v1 + with: + image: ghcr.io/${{ github.repository }}:${{ inputs.branch_hash }} + file: environments/${{ github.event.repository.name }}/${{inputs.environments}}/crms-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}} diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml index 933e8119..8fcf81ea 100644 --- a/.github/workflows/tag-release.yaml +++ b/.github/workflows/tag-release.yaml @@ -1,4 +1,3 @@ ---- name: Docker Tag Latest Release on: @@ -12,6 +11,6 @@ jobs: - uses: hathitrust/github_actions/tag-release@v1 with: registry_token: ${{ github.token }} - existing_tag: ghcr.io/${{ github.repository }}-unstable:${{ github.sha }} + existing_tag: ghcr.io/${{ github.repository }}:${{ github.sha }} image: ghcr.io/${{ github.repository }} new_tag: ${{ github.event.release.tag_name }}