From 7c8072b295029894f03eb3665be629019942dca7 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:20:54 +0200 Subject: [PATCH 1/4] add separate compile step should be run on every push to a branch to check for compilability --- .gitea/workflows/compile.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .gitea/workflows/compile.yaml diff --git a/.gitea/workflows/compile.yaml b/.gitea/workflows/compile.yaml new file mode 100644 index 0000000..0309d61 --- /dev/null +++ b/.gitea/workflows/compile.yaml @@ -0,0 +1,17 @@ +name: Compile the repository +on: [push] +env: + REGISTRY: gitea.brudi.xyz + IMAGE_NAME: ${{ gitea.repository }} + USER: ${{ gitea.actor }} +jobs: + compile: + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Build Container + run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" . -- 2.45.2 From ce4441cee3a669d778e1c87617a8f6bd299722bb Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:22:53 +0200 Subject: [PATCH 2/4] add restriction to master branch on docker push job --- .gitea/workflows/docker-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index 995fa23..d7dbeac 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -8,6 +8,7 @@ env: jobs: build-docker-image: runs-on: ubuntu-latest + if: gitea.ref == 'refs/heads/master' container: catthehacker/ubuntu:act-latest permissions: contents: read -- 2.45.2 From 2c09033c3f79675c0b5f45c54137f2eac05ea28c Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:27:49 +0200 Subject: [PATCH 3/4] add new tag restriction to docker push job --- .gitea/workflows/docker-build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index d7dbeac..eb3985f 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -1,6 +1,9 @@ name: Build a docker image for node-jellyfin-role-bot run-name: ${{ gitea.actor }} is building an image -on: [push] +on: + push: + tags: + - '*' env: REGISTRY: gitea.brudi.xyz IMAGE_NAME: ${{ gitea.repository }} -- 2.45.2 From 1e6a75687a8e635706cc4e83a446542e62de81b4 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:31:03 +0200 Subject: [PATCH 4/4] add package version extraction to docker push job --- .gitea/workflows/docker-build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index eb3985f..fe5fe7a 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -19,9 +19,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Get Package Version + run: VERSION = node -p "require('./package.json').version" - name: Log in to the Container registry run: docker login -u ${{ env.USER }} -p ${{ secrets.TOKEN }} ${{ env.REGISTRY }} - name: Build Container - run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" . + run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}". - name: Push Container run: docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" -- 2.45.2