From 4e8d98aa1345e47fac4d5a4b247d553c18bb6002 Mon Sep 17 00:00:00 2001 From: Jan <45685070+LeRoid-hub@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:32:16 +0200 Subject: [PATCH 1/4] Create gotestnbuild.yml --- .github/workflows/gotestnbuild.yml | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/gotestnbuild.yml diff --git a/.github/workflows/gotestnbuild.yml b/.github/workflows/gotestnbuild.yml new file mode 100644 index 0000000..017e89b --- /dev/null +++ b/.github/workflows/gotestnbuild.yml @@ -0,0 +1,51 @@ +name: Go Tests & Build + +on: + push: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + IMAGE_NAME: leroid-hub/mensa-api:latest + PAT: ${{ secrets.PAT }} + +jobs: + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + + - name: Build + run: go build -v ./... + - name: Actions Ntfy + run: | + curl \ + -u ${{ secrets.NTFY_CRED }} \ + -H "Title: Github barfuss.email" \ + -H "Content-Type: text/plain" \ + -d $'Repo: ${{ github.repository }}\nCommit: ${{ github.sha }} - ${{ github.event.head_commit.message }}\nRef: ${{ github.ref }}\nStatus: ${{ job.status}}' \ + ${{ secrets.NTFY_URL }} + +# - name: Test +# run: go test -v ./... + + build: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Login + run: | + echo ${{ env.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Build and Publish + run: | + docker build . --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} From 0589466aa77a917ad074c130612617cb911445aa Mon Sep 17 00:00:00 2001 From: Jan <45685070+LeRoid-hub@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:50:36 +0200 Subject: [PATCH 2/4] Update gotestnbuild.yml --- .github/workflows/gotestnbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gotestnbuild.yml b/.github/workflows/gotestnbuild.yml index 017e89b..f924495 100644 --- a/.github/workflows/gotestnbuild.yml +++ b/.github/workflows/gotestnbuild.yml @@ -28,7 +28,7 @@ jobs: run: | curl \ -u ${{ secrets.NTFY_CRED }} \ - -H "Title: Github barfuss.email" \ + -H "Title: Github ${{ env.IMAGE_NAME }}" \ -H "Content-Type: text/plain" \ -d $'Repo: ${{ github.repository }}\nCommit: ${{ github.sha }} - ${{ github.event.head_commit.message }}\nRef: ${{ github.ref }}\nStatus: ${{ job.status}}' \ ${{ secrets.NTFY_URL }} From dace1cfa2ac8cadcbc5e6474a71da13ab50af898 Mon Sep 17 00:00:00 2001 From: Jan <45685070+LeRoid-hub@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:53:56 +0200 Subject: [PATCH 3/4] Update gotestnbuild.yml --- .github/workflows/gotestnbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gotestnbuild.yml b/.github/workflows/gotestnbuild.yml index f924495..7d0ed79 100644 --- a/.github/workflows/gotestnbuild.yml +++ b/.github/workflows/gotestnbuild.yml @@ -7,7 +7,7 @@ on: env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - IMAGE_NAME: leroid-hub/mensa-api:latest + IMAGE_NAME: leroid-hub/Mensa-API:latest PAT: ${{ secrets.PAT }} jobs: From e91fc4168cde69865af81caa9f8bcfb4b299be66 Mon Sep 17 00:00:00 2001 From: Jan <45685070+LeRoid-hub@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:54:52 +0200 Subject: [PATCH 4/4] Update gotestnbuild.yml --- .github/workflows/gotestnbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gotestnbuild.yml b/.github/workflows/gotestnbuild.yml index 7d0ed79..f924495 100644 --- a/.github/workflows/gotestnbuild.yml +++ b/.github/workflows/gotestnbuild.yml @@ -7,7 +7,7 @@ on: env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - IMAGE_NAME: leroid-hub/Mensa-API:latest + IMAGE_NAME: leroid-hub/mensa-api:latest PAT: ${{ secrets.PAT }} jobs: