Skip to content

Upgrade dependencies from package.json #129

Upgrade dependencies from package.json

Upgrade dependencies from package.json #129

Workflow file for this run

name: build
on:
push:
branches:
- master
tags:
- '*'
paths-ignore:
- '*.md'
pull_request:
paths-ignore:
- '*.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up go 1.18
uses: actions/setup-go@v3
with:
go-version: 1.18
id: go
- name: Checkout
uses: actions/checkout@v3
- name: Build and test
run: |
go test -v -timeout=60s -race -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./...
cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov
working-directory: app
env:
GOFLAGS: "-mod=vendor"
TZ: "UTC"
- name: Install golangci-lint and goveralls
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.51.1
GO111MODULE=off go get -u github.com/mattn/goveralls
- name: Run linters
run: $GITHUB_WORKSPACE/golangci-lint run
env:
GOFLAGS: "-mod=vendor"
TZ: "UTC"
- name: Submit coverage
run: $(go env GOPATH)/bin/goveralls -service="github" -coverprofile=$GITHUB_WORKSPACE/profile.cov
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available platforms
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Deploy tagged (latest) to GitHub Packages (ghcr.io) and DockerHub
if: ${{ startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_PACKAGE_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
USERNAME: ${{ github.actor }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
run: |
ref="$(echo ${GITHUB_REF} | cut -d'/' -f3)"
echo GITHUB_REF - $ref
echo ${GITHUB_PACKAGE_TOKEN} | docker login ghcr.io -u ${USERNAME} --password-stdin
echo ${DOCKER_HUB_TOKEN} | docker login -u ${USERNAME} --password-stdin
docker buildx build --push \
--build-arg CI=github --build-arg GITHUB_SHA=${GITHUB_SHA} --build-arg GIT_BRANCH=${ref} \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
-t ghcr.io/${USERNAME}/doku:${ref} -t ghcr.io/${USERNAME}/doku:latest \
-t ${USERNAME}/doku:${ref} -t ${USERNAME}/doku:latest .