From 9ba9c05ed7f8cbdcfb5b89d227123dde7767d7bb Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Wed, 12 Nov 2025 13:38:22 -0500 Subject: [PATCH] feat: Adds release workflow and rearranges tags used to build images. --- .gitea/workflows/ci.yaml | 3 +- .gitea/workflows/release.yaml | 62 +++++++++++++++++++++++++++++++++++ README.md | 9 ++--- 3 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 0abfddb..30e829e 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -42,13 +42,12 @@ jobs: # 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@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch type=sha - type=raw,value=latest - name: Build and push Docker image id: push uses: docker/build-push-action@v6 diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..0379bbe --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -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 }} diff --git a/README.md b/README.md index 594c0f3..22605ec 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,18 @@ is used to develop inside a docker container. ## Usage ```bash -podman run -it --name "$(basename "$pwd")" \ +podman run -it --name "$(basename "$PWD")" \ -v "$HOME/.config/nvim":/root/.config/nvim \ -v "$HOME/.local/share/nvim":/root/.local/share/nvim \ - -v "$(pwd)":/root/dev \ + -v "$PWD":/root/dev \ -w /root/dev \ - git.housh.dev/michael/swift-dev:latest \ - /bin/bash + git.housh.dev/michael/swift-dev-container:latest ``` ### 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 in the future to continue working on a project.