From 2d2e5b756042091f18d2b1b0b52a0906d773ce01 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 7 Mar 2024 12:00:47 +0530 Subject: [PATCH] Add build and docker publish workflows --- .gitea/workflows/build.yml | 17 +++++++++++++++++ .gitea/workflows/docker-image.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 .gitea/workflows/docker-image.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 00000000..79b5d544 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,17 @@ +name: Build +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: 1.21 + check-latest: true + - run: | + make build diff --git a/.gitea/workflows/docker-image.yml b/.gitea/workflows/docker-image.yml new file mode 100644 index 00000000..528c801a --- /dev/null +++ b/.gitea/workflows/docker-image.yml @@ -0,0 +1,28 @@ +name: Publish on release +on: + release: + types: [published] +jobs: + build: + name: Run docker build and publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run docker build + run: docker build -t cerc-io/laconic2d -f Dockerfile . + - name: Get the version + id: vars + run: | + echo ::set-output name=sha::$(echo ${GITHUB_SHA:0:7}) + echo ::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/}) + - name: Tag docker image + run: docker tag cerc-io/laconic2d git.vdb.to/cerc-io/laconic2d/laconic2d:${{steps.vars.outputs.sha}} + - name: Tag docker image + run: docker tag git.vdb.to/cerc-io/laconic2d/laconic2d:${{steps.vars.outputs.sha}} git.vdb.to/cerc-io/laconic2d/laconic2d:${{steps.vars.outputs.tag}} + - name: Docker Login + run: echo ${{ secrets.CICD_PUBLISH_TOKEN }} | docker login https://git.vdb.to -u cerccicd --password-stdin + - name: Docker Push + run: docker push git.vdb.to/cerc-io/laconic2d/laconic2d:${{steps.vars.outputs.sha}} + - name: Docker Push TAGGED + run: docker push git.vdb.to/cerc-io/laconic2d/laconic2d:${{steps.vars.outputs.tag}} +