Skip to content

Bump the gh-actions group across 1 directory with 7 updates (#100) #121

Bump the gh-actions group across 1 directory with 7 updates (#100)

Bump the gh-actions group across 1 directory with 7 updates (#100) #121

Workflow file for this run

name: Docker Image
on:
push:
branches:
- main
tags:
- 'v*'
paths:
- Dockerfile
- '**.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/docker.yml'
pull_request:
branches:
- main
paths:
- Dockerfile
- '**.go'
- 'go.mod'
- 'go.sum'
workflow_dispatch:
env:
IMAGE_NAME: mdeous/plasmid
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
packages: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Log into GitHub container registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: mdeous
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get plasmid version
id: get_version
run: |
version=""
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
version="nightly"
else
version="$(make version)"
fi
echo "Version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
with:
install: true
- name: Pull latest image
run: docker pull ghcr.io/${IMAGE_NAME}:latest
continue-on-error: true
- name: Build image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
pull: true
push: false
cache-from: ghcr.io/${{ env.IMAGE_NAME }}:latest
tags: ${{ env.IMAGE_NAME }}:ci
outputs: type=docker,dest=/tmp/image.tar
build-args: "VERSION=${{ steps.get_version.outputs.version }}"
- name: Upload image archive
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
with:
name: plasmid-image
path: /tmp/image.tar
publish:
name: Publish
needs: build
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
registry:
- ghcr.io
- docker.io
include:
- registry: ghcr.io
secret: GITHUB_TOKEN
- registry: docker.io
secret: DOCKER_TOKEN
steps:
- name: Download image archive
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v4
with:
name: plasmid-image
path: /tmp/
- name: Import image
run: docker load --input /tmp/image.tar
- name: Log into Docker registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ matrix.registry }}
username: mdeous
password: ${{ secrets[matrix.secret] }}
- name: Get image version
id: get_version
run: |
version=""
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
version="latest"
else
version="${GITHUB_REF##*/}"
fi
echo "Image version: ${version}"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Tag image
run: docker tag ${IMAGE_NAME}:ci ${{ matrix.registry }}/${IMAGE_NAME}:${IMAGE_VERSION}
env:
IMAGE_VERSION: ${{ steps.get_version.outputs.version }}
- name: Tag latest image
if: ${{ steps.get_version.outputs.version }} != 'latest'

Check warning on line 142 in .github/workflows/docker.yml

View workflow run for this annotation

GitHub Actions / Docker Image

Workflow syntax warning

.github/workflows/docker.yml (Line: 142, Col: 13): Conditional expression contains literal text outside replacement tokens. This will cause the expression to always evaluate to truthy. Did you mean to put the entire expression inside ${{ }}?
run: docker tag ${IMAGE_NAME}:ci ${{ matrix.registry }}/${IMAGE_NAME}:latest
- name: Push image to container registry
run: docker push ${{ matrix.registry }}/${IMAGE_NAME}:${IMAGE_VERSION}
env:
IMAGE_VERSION: ${{ steps.get_version.outputs.version }}
- name: Push latest image to container registry
if: ${{ steps.get_version.outputs.version }} != 'latest'

Check warning on line 151 in .github/workflows/docker.yml

View workflow run for this annotation

GitHub Actions / Docker Image

Workflow syntax warning

.github/workflows/docker.yml (Line: 151, Col: 13): Conditional expression contains literal text outside replacement tokens. This will cause the expression to always evaluate to truthy. Did you mean to put the entire expression inside ${{ }}?
run: docker push ${{ matrix.registry }}/${IMAGE_NAME}:latest