Skip to content

Merge branch 'main' of github.com:k1LoW/tbls #170

Merge branch 'main' of github.com:k1LoW/tbls

Merge branch 'main' of github.com:k1LoW/tbls #170

Workflow file for this run

name: tagpr
on:
push:
branches:
- main
jobs:
tagpr:
runs-on: ubuntu-latest
outputs:
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- id: run-tagpr
name: Run tagpr
uses: Songmu/tagpr@v1
darwin-assets:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: macos-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Setup
run: |
brew install sqlite3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: --config .goreleaser/darwin.yml --clean --skip=publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
run: |
gh release upload ${{ needs.tagpr.outputs.tagpr-tag }} dist/tbls_*.zip dist/checksums-darwin.txt --repo ${{ github.repository }} --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux-assets:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: ubuntu-latest
steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install sqlite3 gcc-aarch64-linux-gnu
- name: Install aws-cli
uses: isbang/[email protected]
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go on Ubuntu
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Start databases
run: |
docker compose up -d
sleep 20s
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: --config .goreleaser/linux.yml --clean --skip=publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration test
run: |
env TBLS=dist/tbls-linux_linux_amd64_v1/tbls make depsdev db doc
git restore .
- name: Upload assets
run: |
gh release upload ${{ needs.tagpr.outputs.tagpr-tag }} dist/tbls_*.tar.gz dist/tbls_*.apk dist/tbls_*.deb dist/tbls_*.rpm dist/checksums-linux.txt --repo ${{ github.repository }} --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows-assets:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: windows-2019
steps:
- name: Use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Install packages
run: |
choco install sqlite
- name: Install aws-cli
uses: isbang/[email protected]
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go on Windows
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run tests
run: env TBLS=tbls.exe make ci_windows
shell: bash
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: --config .goreleaser/windows.yml --clean --skip=publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
run: |
gh release upload ${{ needs.tagpr.outputs.tagpr-tag }} dist/tbls_${{ needs.tagpr.outputs.tagpr-tag }}_windows_amd64.zip dist/checksums-windows.txt --repo ${{ github.repository }} --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerimage:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest version
id: latest_version
run: |
echo -n 'version=' > $GITHUB_OUTPUT
gh release list --limit 1 | cut -f 1 >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
k1low/tbls:latest
k1low/tbls:${{ steps.latest_version.outputs.version }}
ghcr.io/k1low/tbls:latest
ghcr.io/k1low/tbls:${{ steps.latest_version.outputs.version }}
labels: |
org.opencontainers.image.name=tbls
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.latest_version.outputs.version }}
org.opencontainers.image.source=https://github.com/k1LoW/tbls
release:
needs: [tagpr, darwin-assets, linux-assets, windows-assets, dockerimage]
runs-on: ubuntu-latest
steps:
- name: Release
run: |
gh api /repos/${{ github.repository }}/releases/generate-notes -f tag_name=${{ needs.tagpr.outputs.tagpr-tag }} --jq .body | gh release edit ${{ needs.tagpr.outputs.tagpr-tag }} --repo ${{ github.repository }} --draft=false --latest --notes-file=-
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}