2021-10-19 16:17:21 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-01-18 12:04:11 +00:00
|
|
|
- main
|
2021-10-19 16:17:21 +00:00
|
|
|
tags:
|
|
|
|
- "v*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout code
|
2022-03-14 13:06:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-10-19 16:17:21 +00:00
|
|
|
|
|
|
|
- run: |
|
|
|
|
echo "GIT_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: docker_meta
|
2023-05-02 09:41:59 +00:00
|
|
|
uses: docker/metadata-action@v4.4.0
|
2021-10-19 16:17:21 +00:00
|
|
|
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
|
2023-04-03 07:13:36 +00:00
|
|
|
uses: docker/setup-buildx-action@v2.5.0
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
|
|
|
install: true
|
|
|
|
|
|
|
|
-
|
|
|
|
name: Login to GitHub Container Registry
|
2022-10-18 09:23:59 +00:00
|
|
|
uses: docker/login-action@v2.1.0
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ github.token }}
|
|
|
|
|
|
|
|
-
|
|
|
|
name: Login to Docker Container Registry
|
2022-10-18 09:23:59 +00:00
|
|
|
uses: docker/login-action@v2.1.0
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: build
|
2023-02-06 16:58:02 +00:00
|
|
|
uses: docker/build-push-action@v4
|
2021-10-19 16:17:21 +00:00
|
|
|
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 }}
|
2022-12-05 14:55:57 +00:00
|
|
|
platforms: linux/amd64,linux/arm64/v8
|
2021-10-19 16:17:21 +00:00
|
|
|
|
|
|
|
build-binary:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout code
|
2022-03-14 13:06:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-10-19 16:17:21 +00:00
|
|
|
|
|
|
|
-
|
2023-04-03 07:54:44 +00:00
|
|
|
name: Install Go
|
2023-04-03 07:12:12 +00:00
|
|
|
uses: actions/setup-go@v4
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
2023-04-03 07:54:44 +00:00
|
|
|
go-version: 'stable'
|
2021-10-19 16:17:21 +00:00
|
|
|
|
|
|
|
-
|
|
|
|
name: Build TUSD
|
|
|
|
run: ./scripts/build_all.sh
|
|
|
|
|
|
|
|
-
|
|
|
|
name: GitHub Release
|
2022-11-28 11:13:37 +00:00
|
|
|
uses: softprops/action-gh-release@v0.1.15
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
|
|
|
files: tusd_*.*
|
|
|
|
|
|
|
|
deploy-heroku:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout code
|
2022-03-14 13:06:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-10-19 16:17:21 +00:00
|
|
|
|
|
|
|
-
|
|
|
|
name: Deploy to heroku
|
2023-02-14 22:46:12 +00:00
|
|
|
uses: akhileshns/heroku-deploy@v3.12.13
|
2021-10-19 16:17:21 +00:00
|
|
|
with:
|
|
|
|
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
|
|
|
|
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
|
|
|
|
heroku_email: ${{secrets.HEROKU_USER_EMAIL}}
|
2022-07-20 01:51:42 +00:00
|
|
|
stack: heroku-22
|