Skip to content

Commit

Permalink
MAINT: Change to use staging credentials for staging project
Browse files Browse the repository at this point in the history
  • Loading branch information
khalford committed Sep 30, 2024
1 parent 1cd7409 commit f870b25
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/build_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
outputs:
images: ${{ steps.metadata.outputs.images }}
sha: ${{ steps.metadata.outputs.sha_short }}
build:
build-staging:
needs: setup
runs-on: ubuntu-latest
strategy:
Expand All @@ -40,15 +40,8 @@ jobs:
uses: docker/login-action@v3
with:
registry: harbor.stfc.ac.uk
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Build & push to prod
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v3
with:
push: true
context: "{{defaultContext}}:${{ matrix.image }}"
tags: "harbor.stfc.ac.uk/stfc-cloud/${{ matrix.image }}:latest"
username: ${{ secrets.STAGING_HARBOR_USERNAME }}
password: ${{ secrets.STAGING_HARBOR_TOKEN }}
- name: Build & push to staging
if: ${{ github.ref != 'refs/heads/master' }}
uses: docker/build-push-action@v3
Expand All @@ -61,7 +54,38 @@ jobs:
- name: Inform of tagged name
if: ${{ github.ref != 'refs/heads/master' }}
run: echo "::notice title=published::harbor.stfc.ac.uk/stfc-cloud-staging/${{ matrix.image }}:${{ needs.setup.outputs.sha }}"
finished: # convenient single job name to apply branch protection to
needs: build


build-prod:
needs: build-staging
runs-on: ubuntu-latest
steps: [{run: true}]
strategy:
fail-fast: false
matrix:
image: ${{ fromJson(needs.setup.outputs.images) }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- name: Login to DockerHub # increase pull rate limit
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Harbor
uses: docker/login-action@v3
with:
registry: harbor.stfc.ac.uk
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Build & push to prod
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v3
with:
push: true
context: "{{defaultContext}}:${{ matrix.image }}"
tags: "harbor.stfc.ac.uk/stfc-cloud/${{ matrix.image }}:latest"

finished: # convenient single job name to apply branch protection to
needs: build-prod
runs-on: ubuntu-latest
steps: [{run: true}]

0 comments on commit f870b25

Please sign in to comment.