Skip to content

Store relative paths for the actual files to send file scans to Emby & #28

Store relative paths for the actual files to send file scans to Emby &

Store relative paths for the actual files to send file scans to Emby & #28

Workflow file for this run

name: Build
on:
push:
branches:
- '*'
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
# dependencies
- name: goreleaser
uses: goreleaser/goreleaser-action@v4
with:
install-only: true
version: latest
- name: goreleaser info
run: goreleaser -v
- name: task
uses: arduino/setup-task@v1
- name: task info
run: task --version
- name: qemu
uses: docker/setup-qemu-action@v2
- name: buildx
uses: docker/setup-buildx-action@v2
# checkout
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# setup go
- name: go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: go info
run: |
go version
go env
# cache
- name: cache-go
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-cache-mod
- name: cache-task
uses: actions/cache@v3
with:
path: .task/**/*
key: ${{ runner.os }}-go-task
# vendor
- name: vendor
run: |
task vendor
# test
- name: tests
run: |
task test
# git status
- name: git status
run: git status
# build
- name: build
if: startsWith(github.ref, 'refs/tags/') == false
run: |
task snapshot
# publish
- name: publish
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REF: ${{ github.ref }}
run: |
task publish
# artifacts
- name: artifact_linux
uses: actions/upload-artifact@v3
with:
name: build_linux
path: dist/*linux*
# docker login
- name: docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# docker build (latest & tag)
- name: release tag
if: startsWith(github.ref, 'refs/tags/') == true
uses: little-core-labs/[email protected]
id: releasetag
with:
tagRegex: "v?(.+)"
- name: docker - build release
if: startsWith(github.ref, 'refs/tags/') == true
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
pull: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/darthshadow/autoscan:${{ steps.releasetag.outputs.tag }}
ghcr.io/darthshadow/autoscan:latest
# docker build (branch)
- name: branch name
if: startsWith(github.ref, 'refs/tags/') == false
id: branch-name
uses: tj-actions/[email protected]
- name: docker tag
if: startsWith(github.ref, 'refs/tags/') == false
uses: frabert/[email protected]
id: dockertag
with:
pattern: '[:\.\/]+'
string: "${{ steps.branch-name.outputs.current_branch }}"
replace-with: '-'
flags: 'g'
- name: docker - build branch
if: startsWith(github.ref, 'refs/tags/') == false
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
pull: true
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/darthshadow/autoscan:${{ steps.dockertag.outputs.replaced }}
# cleanup
- name: cleanup
run: |
rm -f ${HOME}/.docker/config.json