Skip to content

Commit

Permalink
ci: publish docker-image
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Aug 29, 2024
1 parent 14762ce commit 1b74dde
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Create and publish a Docker image

on:
pull_request:
branches: [main]
push:
branches: [main]

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- name: Build docker image
run: nix build .#cctl-docker-image
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: tag the docker image
run: |
IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/$(basename ${{ github.repository }})"
docker load -i result
docker tag cctl:cctl-casper-node-1.5.7 $IMAGE_NAME:cctl-casper-node-1.5.7
- name: push
run: |
IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/$(basename ${{ github.repository }})"
docker push $IMAGE_NAME:cctl-casper-node-1.5.7

0 comments on commit 1b74dde

Please sign in to comment.