name: build on: push: tags: - 'v*' jobs: release-pingme: runs-on: ubuntu-latest env: DOCKER_CLI_EXPERIMENTAL: "enabled" steps: - name: Checkout uses: actions/checkout@v2.3.4 with: fetch-depth: 0 - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Set up Go uses: actions/setup-go@v2 with: go-version: '1.16' - name: Cache Go modules uses: actions/cache@v2.1.5 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Diff run: git diff - name: Docker Login if: success() && startsWith(github.ref, 'refs/tags/v') env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }} run: | echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin echo "${GITHUB_TOKEN}" | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin - name: GoReleaser if: success() env: GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }} run: | if [[ $GITHUB_REF == refs/tags/v* ]]; then ./goreleaser elif [[ $GITHUB_REF == refs/heads/master ]]; then ./goreleaser --snapshot fi - name: Clear if: always() && startsWith(github.ref, 'refs/tags/v') run: | rm -f ${HOME}/.docker/config.json