[Snyk] Security upgrade alpine from 3.17.0 to 3.18.5 #14
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: webrtc-media-server | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
pull_request: | |
branches: | |
- main | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
# github.branch as <branch> | |
IMAGE_TAG: ${{ github.sha }} | |
jobs: | |
lint: | |
name: Run linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.17 | |
- uses: actions/checkout@v3 | |
- name: golangci-lint | |
uses: reviewdog/action-golangci-lint@v2 | |
test: | |
name: Run test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: | |
go test -v ./... | |
build: | |
if: github.ref == 'refs/heads/main' || github.event.release.target_commitish == 'main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build image | |
run: docker build . --build-arg VERSION="$(git describe --always --tags --dirty)" --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" | |
- name: Log in to registry | |
run: echo "${{ secrets.ACCESS_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image | |
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
run: | | |
IMAGE_ID=ghcr.io/$IMAGE_NAME | |
# Change all uppercase to lowercase | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
# Strip git ref prefix from version | |
VERSION=$IMAGE_TAG | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "${{ github.ref }}" == "refs/heads/main" ] && VERSION=latest | |
echo IMAGE_ID=$IMAGE_ID | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
docker push $IMAGE_ID:$VERSION |