114 lines
2.7 KiB
YAML
114 lines
2.7 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- run: |
|
|
echo "GIT_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: docker/metadata-action@v4.1.1
|
|
with:
|
|
images: |
|
|
ghcr.io/tus/tusd
|
|
tusproject/tusd
|
|
tags: |
|
|
type=sha
|
|
type=semver,pattern=v{{version}}
|
|
type=semver,pattern=v{{major}}.{{minor}}
|
|
type=semver,pattern=v{{major}}
|
|
|
|
-
|
|
name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v2.2.1
|
|
with:
|
|
install: true
|
|
|
|
-
|
|
name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ github.token }}
|
|
|
|
-
|
|
name: Login to Docker Container Registry
|
|
uses: docker/login-action@v2.1.0
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
-
|
|
name: Build and push
|
|
id: build
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
push: true
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha
|
|
build-args: |
|
|
GIT_VERSION=${{ env.GIT_VERSION }}
|
|
GIT_COMMIT=${{ github.sha }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
build-binary:
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
GO111MODULE: on
|
|
steps:
|
|
-
|
|
name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
name: Install Go 1.19
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: '1.19.5'
|
|
|
|
-
|
|
name: Build TUSD
|
|
run: ./scripts/build_all.sh
|
|
|
|
-
|
|
name: GitHub Release
|
|
uses: softprops/action-gh-release@v0.1.15
|
|
with:
|
|
files: tusd_*.*
|
|
|
|
deploy-heroku:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
name: Deploy to heroku
|
|
uses: akhileshns/heroku-deploy@v3.12.12
|
|
with:
|
|
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
|
|
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
|
|
heroku_email: ${{secrets.HEROKU_USER_EMAIL}}
|
|
stack: heroku-22
|