From 59ff5034f95337ac01b3476a1ee01e7c2bdef692 Mon Sep 17 00:00:00 2001 From: asmogo Date: Wed, 28 Aug 2024 22:37:39 +0200 Subject: [PATCH] Update Github action (#38) --- .github/workflows/{master.yml => main.yaml} | 8 ++-- .github/workflows/tag.yml | 42 ++++++++++----------- .github/workflows/test.yml | 2 +- cmd/nws/Dockerfile => Dockerfile | 0 docker-compose.yaml | 3 -- 5 files changed, 24 insertions(+), 31 deletions(-) rename .github/workflows/{master.yml => main.yaml} (91%) rename cmd/nws/Dockerfile => Dockerfile (100%) diff --git a/.github/workflows/master.yml b/.github/workflows/main.yaml similarity index 91% rename from .github/workflows/master.yml rename to .github/workflows/main.yaml index 128f1b6..b7555a3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/main.yaml @@ -1,11 +1,9 @@ -name: gobuild +name: latest on: push: - # run only against tags - tags: - - '*' - + branches: + - master jobs: docker: runs-on: ubuntu-latest diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 2b51278..a1ed5f7 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -1,4 +1,5 @@ -name: goreleaser +name: gobuild + on: push: @@ -6,30 +7,27 @@ on: tags: - '*' -permissions: - contents: write - # packages: write - # issues: write jobs: - goreleaser: + docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 with: - fetch-depth: 0 - - run: git fetch --force --tags - - uses: actions/setup-go@v3 + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Docker Setup Buildx + uses: docker/setup-buildx-action@v2.0.0 + - name: Build and push + uses: docker/build-push-action@v3 with: - go-version: '>=1.21.2' - cache: true - # More assembly might be required: Docker logins, GPG, etc. It all depends - # on your needs. - - uses: goreleaser/goreleaser-action@v2 - with: - # either 'goreleaser' (default) or 'goreleaser-pro' - distribution: goreleaser - version: latest - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 + push: true + tags: asmogo/nws:${{github.ref_name}} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f105e8c..01c5745 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: tests -on: [ push, pull_request ] +on: [ pull_request ] jobs: golang: diff --git a/cmd/nws/Dockerfile b/Dockerfile similarity index 100% rename from cmd/nws/Dockerfile rename to Dockerfile diff --git a/docker-compose.yaml b/docker-compose.yaml index 917c614..08a5dc0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -26,7 +26,6 @@ services: exit: build: context: . - dockerfile: cmd/nws/Dockerfile container_name: exit command: [ "./nws","exit" ] networks: @@ -41,7 +40,6 @@ services: exit-https: build: context: . - dockerfile: cmd/nws/Dockerfile container_name: exit-https command: ["./nws","exit","--port", "4443", "--target", "http://mint:3338"] networks: @@ -56,7 +54,6 @@ services: entry: build: context: . - dockerfile: cmd/nws/Dockerfile command: [ "./nws","entry"] container_name: entry ports: