add tag only

This commit is contained in:
Adrien Beaudouin 2024-08-14 16:56:45 +02:00
parent 40d8ef8731
commit a80595f1cb
3 changed files with 40 additions and 10 deletions

7
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"yaml.schemas": {
"https://raw.githubusercontent.com/number5/cloud-init/main/cloudinit/config/schemas/schema-cloud-config-v1.json": "cloud-config.yml",
"file:///c%3A/Users/Adrien/.vscode/extensions/atlassian.atlascode-3.0.3/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml",
"https://json.schemastore.org/github-workflow.json": "file:///c%3A/Users/Adrien/Projects/okami101/actions/deploy.yaml"
}
}

33
deploy.yaml Normal file
View File

@ -0,0 +1,33 @@
name: Docker build test
on:
workflow_call:
registry:
description: "Server address of Docker registry."
default: ${{ vars.CONTAINER_REGISTRY }}
username:
description: "Username used to log against the Docker registry"
default: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
password:
description: "Password or personal access token used to log against the Docker registry"
required: true
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
steps:
- uses: https://gitea.okami101.io/okami101/actions/docker@main
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: Push tags
shell: bash
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
env:
DOCKER_IMAGE: ${{ inputs.registry }}/${{ gitea.repository }}
run: |
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:latest
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:${{ steps.meta.outputs.version }}
docker push -a $DOCKER_IMAGE

View File

@ -25,18 +25,8 @@ runs:
username: ${{ inputs.username }} username: ${{ inputs.username }}
password: ${{ inputs.password }} password: ${{ inputs.password }}
- uses: docker/build-push-action@v6 - uses: docker/build-push-action@v6
if: ${{ !startsWith(gitea.ref, 'refs/tags/v') }}
with: with:
context: . context: .
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Push tags
shell: bash
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
env:
DOCKER_IMAGE: ${{ inputs.registry }}/${{ gitea.repository }}
run: |
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:latest
docker tag $DOCKER_IMAGE:main $DOCKER_IMAGE:${{ steps.meta.outputs.version }}
docker push -a $DOCKER_IMAGE