Skip to content

feat: upgrade and support loading secrets from files #14

feat: upgrade and support loading secrets from files

feat: upgrade and support loading secrets from files #14

Workflow file for this run

name: Tests, build and publish
on:
push:
branches: [ master ]
tags: [ v* ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: ^1.21
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Get dependencies
run: go mod download
- name: Test
run: go test -v ./...
docker-build:
runs-on: ubuntu-latest
needs: [tests]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build image
run: docker build . -t image
- name: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push image
run: |
IMAGE_ID=${{ secrets.DOCKER_USERNAME }}/restic-controller
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION