chore(deps): update docker/login-action action to v3 #125
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: Publish Runner Image by using Packer | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'images/**' | |
- '.github/workflows/packer-publish-image.yaml' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'images/**' | |
- '.github/workflows/packer-publish-image.yaml' | |
permissions: | |
contents: read | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository_owner }}/actions-runner | |
PACKER_PRODUCT_VERSION: "1.8.6" | |
RUNNER_VERSION: 2.322.0 | |
jobs: | |
packer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup `packer` | |
uses: hashicorp/setup-packer@main | |
id: setup | |
with: | |
version: ${{ env.PACKER_PRODUCT_VERSION }} | |
- name: Run `packer init` | |
id: init | |
run: | | |
packer init ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl | |
- name: Run `packer validate template` | |
id: validate | |
run: | | |
packer validate ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl | |
- name: Run `packer build` | |
run: | | |
packer build --var artifact_image_repository=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} --var artifact_image_tag=${{ env.RUNNER_VERSION }}rc${{ github.run_number }} ./images/ubuntu/templates/docker-ubuntu-22.04.pkr.hcl | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: github.event_name == 'push' | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image to ${{ env.REGISTRY }} | |
if: github.event_name == 'push' | |
run: | | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RUNNER_VERSION }}rc${{ github.run_number }} |