- [#] -tkb TranspBy implemented; closes #32 #116
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: build | |
env: | |
TEST_DIRS: test test2 | |
TEST_NAME: ./test-all.sh | |
GO111MODULE: off | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- | |
name: Install & cache ffmpeg | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: ffmpeg | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- | |
name: Tests | |
run: | | |
export GOPATH=/home/runner/go | |
mkdir -vp $GOPATH/src/github.com/$GITHUB_REPOSITORY | |
rmdir -v $GOPATH/src/github.com/$GITHUB_REPOSITORY | |
mv -v $GITHUB_WORKSPACE $GOPATH/src/github.com/$GITHUB_REPOSITORY | |
ln -vs $GOPATH/src/github.com/$GITHUB_REPOSITORY $GITHUB_WORKSPACE | |
# go mod tidy | |
go get -v ./... | |
go build -v | |
go test -v ./... | |
for d in ${TEST_DIRS}; do | |
echo Testing in folder \"$d\"; ( cd $d; $TEST_NAME; ); | |
done | |
- | |
name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Install Cloudsmith CLI | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
run: pip install --upgrade cloudsmith-cli | |
# Cloudsmith CLI tooling for pushing releases | |
# See https://help.cloudsmith.io/docs/cli | |
# Publish to cloudsmith repo | |
- | |
name: Publish package to cloudsmith | |
if: success() && startsWith(github.ref, 'refs/tags/') | |
env: | |
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | |
run: | | |
for filepath in dist/*; do | |
echo "== Analyzing '$filepath' for publishing" | |
filename=$(basename -- "$filepath") | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
case "$extension" in | |
'apk') | |
echo "Pushing '$filepath' to cloudsmith repo" | |
cloudsmith push alpine suntong/repo/alpine/any-version $filepath | |
;; | |
'deb' | 'rpm') | |
echo "Pushing '$filepath' to cloudsmith repo" | |
cloudsmith push $extension suntong/repo/any-distro/any-version $filepath | |
;; | |
*) | |
echo "File .$extension skipped publishing" | |
echo | |
;; | |
esac | |
done |