Skip to content

Improve container configurations #3

Improve container configurations

Improve container configurations #3

Workflow file for this run

name: Build container image
on:
push:
branches:
- "*"
tags:
- "*"
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Set image tag
id: image-tag
run: |
if [[ ${{ github.ref }} == refs/tags/* ]]; then
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref }} == refs/heads/main ]]; then
echo "IMAGE_TAG=latest" >> $GITHUB_OUTPUT
elif [[ ${{ github.ref }} == refs/heads/develop ]]; then
echo "IMAGE_TAG=develop" >> $GITHUB_OUTPUT
else
echo "IMAGE_TAG=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/facorazza/passwords2bitwarden:${{ steps.image-tag.outputs.IMAGE_TAG }}