feat: Adds release workflow and rearranges tags used to build images.
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 4m34s

This commit is contained in:
2025-11-12 13:38:22 -05:00
parent 4d34d97187
commit 9ba9c05ed7
3 changed files with 68 additions and 6 deletions

View File

@@ -42,13 +42,12 @@ jobs:
# subsequent step. The `images` value provides the base name for the tags and labels. # subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker - name: Extract metadata (tags, labels) for Docker
id: meta id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 uses: docker/metadata-action@v5
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: | tags: |
type=ref,event=branch type=ref,event=branch
type=sha type=sha
type=raw,value=latest
- name: Build and push Docker image - name: Build and push Docker image
id: push id: push
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6

View File

@@ -0,0 +1,62 @@
name: Create and publish a Docker image
# Configures this workflow to run every time a change is pushed to the main branch with a semvar tag.
on:
push:
tags:
- '*.*.*'
workflow_dispatch:
# Defines two custom environment variables for the workflow. These are used for the Container registry domain,
# and a name for the Docker image that this workflow builds.
env:
REGISTRY: git.housh.dev
IMAGE_NAME: ${{ gitea.repository }}
# 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:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: 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: ${{ gitea.actor }}
password: ${{ secrets.CONTAINER_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels
# that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a
# subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semvar,pattern={{version}}
type=sha
type=raw,value=latest
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -19,17 +19,18 @@ is used to develop inside a docker container.
## Usage ## Usage
```bash ```bash
podman run -it --name "$(basename "$pwd")" \ podman run -it --name "$(basename "$PWD")" \
-v "$HOME/.config/nvim":/root/.config/nvim \ -v "$HOME/.config/nvim":/root/.config/nvim \
-v "$HOME/.local/share/nvim":/root/.local/share/nvim \ -v "$HOME/.local/share/nvim":/root/.local/share/nvim \
-v "$(pwd)":/root/dev \ -v "$PWD":/root/dev \
-w /root/dev \ -w /root/dev \
git.housh.dev/michael/swift-dev:latest \ git.housh.dev/michael/swift-dev-container:latest
/bin/bash
``` ```
### Notes ### Notes
The default command will open neovim in the `/root/dev` folder.
The above runs a container and names it so that it can be restarted The above runs a container and names it so that it can be restarted
in the future to continue working on a project. in the future to continue working on a project.