Update actions/checkout action to v4 #15
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
name: Push-Image | |
on: | |
push: | |
branches: [main] | |
tags: | |
- v* | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: healthznerbot | |
jobs: | |
# test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# # Get current package.json Version | |
# - name: Get current package version | |
# id: package-version | |
# uses: martinbeentjes/npm-get-version-action@v1.1.0 | |
# - name: Build Docker Image | |
# id: build-image | |
# run: docker build -t ${{ secrets.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version}} . | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
# Get current package.json Version | |
- name: Get current package version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@v1.3.1 | |
- name: Build Docker Image | |
id: build-image | |
run: docker build --tag ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version}} --label "runnumber=${GITHUB_RUN_ID}" . | |
- name: Log into registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push image (version) | |
run: docker push ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version}} | |
- name: Tag and push image (latest) | |
run: | | |
# Tag and push docker latest image | |
docker tag ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version}} ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKER_IMAGE }}:latest | |
docker push ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKER_IMAGE }}:latest |