Skip to content

Commit

Permalink
Refactor of CI to build and push using repo credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
fmacleal committed Jun 27, 2024
1 parent b007008 commit e6e970f
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REPO }}

- name: Setup Docker BuildX
id: setup-buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -37,13 +43,21 @@ jobs:
driver-opts: network=host
platforms: linux/amd64

- name: Build the RIT Action Container
id: build
- name: GitHub container registry login
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the RIT Action Container Image
uses: docker/build-push-action@v6
with:
context: .github/images
push: true
tags: ${{ env.TEST_TAG }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run the RIT Container Action
id: run
Expand All @@ -60,13 +74,15 @@ jobs:
name: GitHub Actions Test
runs-on: ubuntu-latest
timeout-minutes: 60
container:
image: ghcr.io/rsksmart/rootstock-integration-tests/rit-action
credentials:
username: ${{ secrets.GH_IMAGE_USERNAME }}
password: ${{ secrets.GH_IMAGE_TOKEN }}

steps:
- name: GitHub container registry login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Test RIT Action
id: test-rit-action
uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit-action:latest
Expand Down

0 comments on commit e6e970f

Please sign in to comment.