1 #346
Workflow file for this run
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: Go | |
on: | |
push: | |
branches: [ main, develop, website ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ main, develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.50.1 | |
- name: Build | |
run: go build -tags release -v . | |
- name: Test | |
run: go test -tags release -v -coverprofile=coverage.out ./... | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [ build ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
distribution: goreleaser | |
version: v1.10.3 | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ACCOUNT_GITHUB_TOKEN: ${{ secrets.ACCOUNT_GITHUB_TOKEN }} | |
- name: Publish Package to npmjs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@octocat' | |
- run: npm version $(echo "${GITHUB_REF##*/}" | tr -d 'v') --git-tag-version=false | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Clone site repository | |
uses: actions/checkout@v3 | |
with: | |
repository: evg4b/uncors-website | |
path: site | |
ref: main | |
- name: test | |
run: ls | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --non-interactive | |
- name: Build | |
run: yarn build | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build |