Pe 4649 snyk issues fix (#30) #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.20 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Run test | |
run: make test | |
- name: Test Docker build | |
run: docker build --rm -t ghcr.io/scribd/objinsync:latest . | |
release: | |
name: Release | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: scribdbot | |
password: ${{ secrets.SCRIBDBOT_GH_CONTAINER_REGISTRY_TOKEN }} | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
# required for the changelog to work correctly | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.20 | |
id: go | |
- name: Run goreleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# FIXME: SCRIBDBOT_GH_CONTAINER_REGISTRY_TOKEN doesn't have write access to publish package | |
# - name: Build and publish docker image | |
# run: | | |
# VERSION=${GITHUB_REF##*/} | |
# docker build --rm -t "ghcr.io/scribd/objinsync:${VERSION}" . | |
# docker push "ghcr.io/scribd/objinsync:${VERSION}" |