diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0d6916..4657be6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,6 @@ on: push: branches: - master - tags: - - v* pull_request: jobs: @@ -57,32 +55,3 @@ jobs: - name: Make run: make - - # https://goreleaser.com/ci/actions/ - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - if: startsWith(github.ref, 'refs/tags/v') - with: - version: latest - args: release --rm-dist --timeout=90m - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Install Docker image multi-arch builder - - name: Install seihon ${{ env.SEIHON_VERSION }} - if: startsWith(github.ref, 'refs/tags/v') - run: | - curl -sSfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | sh -s -- -b $(go env GOPATH)/bin ${SEIHON_VERSION} - seihon --version - - - name: Docker Login - if: startsWith(github.ref, 'refs/tags/v') - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - - name: Deploy Docker Images (seihon) - if: startsWith(github.ref, 'refs/tags/v') - run: make publish-images diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dbd11e6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: "Release a tag" +on: + push: + tags: + - v* + +jobs: + release: + name: Release Process + runs-on: ubuntu-latest + env: + GO_VERSION: 1.17 + SEIHON_VERSION: v0.9.0 + CGO_ENABLED: 0 + + steps: + + # https://github.com/marketplace/actions/setup-go-environment + - name: Set up Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + + # https://github.com/marketplace/actions/checkout + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + # https://github.com/marketplace/actions/cache + - name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Make + run: make build + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist --timeout=90m + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install seihon ${{ env.SEIHON_VERSION }} + run: | + curl -sSfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | sh -s -- -b $(go env GOPATH)/bin ${SEIHON_VERSION} + seihon --version + + - name: Docker Login + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + run: | + echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin + + - name: Deploy Docker Images (seihon) + run: make publish-images