diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 689a557..9747bdf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: tags: - '*' jobs: - test: + release: strategy: matrix: go-version: [ 1.17.x ] @@ -16,13 +16,39 @@ jobs: with: go-version: ${{ matrix.go-version }} - - name: Checkout cod + - name: Checkout code uses: actions/checkout@v2 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release --rm-dist --config ./server/. + args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare for image tag + id: prep + run: | + VERSION=${GITHUB_REF#refs/tags/} + echo ::set-output name=version::${VERSION} + + - name: Build and push image + uses: docker/build-push-action@v2 + with: + context: ./server + file: ./server/docker/bookowl.Dockerfile + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/b_2109/bookowl-server:stable + ghcr.io/${{ github.repository_owner }}/b_2109/bookowl-server:${{ steps.prep.outputs.version }} \ No newline at end of file diff --git a/server/.goreleaser.yaml b/.goreleaser.yaml similarity index 90% rename from server/.goreleaser.yaml rename to .goreleaser.yaml index 0a8780a..751fccb 100644 --- a/server/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,6 +1,6 @@ builds: - id: "bookowl" - dir: ./ + dir: server binary: bookowl goos: - linux