Publish Docker image #1
Workflow file for this run
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# GitHub recommends pinning actions to a commit SHA. | |
# To get a newer version, you will need to update the SHA. | |
# You can also reference a tag or branch, but the action may change without warning. | |
# This Workflow is based on GitHub's documentation at https://docs.github.com/en/actions/publishing-packages/publishing-docker-images | |
name: Publish Docker image | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
triggeredBy: | |
description: 'Name of team member who is manually triggering this workflow' | |
required: true | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- run: | | |
echo "This workflow was triggered by: $TRIGGER_PERSON" | |
env: | |
TRIGGER_PERSON: ${{ inputs.triggeredBy }} | |
IMAGE_NAME: hypernetx/hypernetx:latest | |
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v5 | |
with: | |
tags: ${{ env.IMAGE_NAME }} | |
push: true | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: hypernetx/hypernetx | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true |