diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml new file mode 100644 index 0000000..dbada29 --- /dev/null +++ b/.github/workflows/publish-ghcr.yml @@ -0,0 +1,42 @@ +# +name: Create and publish a Docker image + +on: + workflow_dispatch: + + release: + types: [published] + +# Defines environment variables for the workflow. These are used for the Container registry domain, and a version for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + VERSION: ${{ github.ref_name }} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-image-normal: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GH_PAT` for the actions in this job. + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + # 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@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GH_PAT }} + - name: lowercase github.repository + run: | + echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} \ No newline at end of file