Skip to content

Commit

Permalink
feat: ci for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
davideimola committed Feb 3, 2025
1 parent 9a22d72 commit 1eabb3d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches:
- 'main'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Vars
id: get_vars
run: |
echo "ts=$(date +%s)" >> $GITHUB_OUTPUT
echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: |
ghcr.io/${{ github.repository }}/api
tag-sha: true
tag-semver: |
{{version}}
{{major}}.{{minor}}
tag-custom: |
${{ steps.get_vars.outputs.branch }}-${{ steps.get_vars.outputs.sha }}-${{ steps.get_vars.outputs.ts }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Digital Ocean Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./src/ign-api
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_mata.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 1eabb3d

Please sign in to comment.