fix unused import #367
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: Create tagged release | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
cache-dependency-path: ./go.sum | |
- | |
name: Generate | |
run: go generate . | |
- | |
name: Test | |
run: go test -v ./... | |
create_release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
tag: ${{ steps.tag.outputs.tag }} | |
steps: | |
# - | |
# name: Action Checkout | |
# uses: actions/checkout@v4 | |
- | |
name: Output TAG | |
id: tag | |
run: | | |
export RELEASE_VERSION="${GITHUB_REF#refs/*/}" | |
echo "tag=${RELEASE_VERSION}" | |
echo "tag=${RELEASE_VERSION}" >> "$GITHUB_OUTPUT" | |
- | |
name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ steps.tag.outputs.tag }} | |
draft: true | |
prerelease: false | |
# - | |
# name: Upload Certificates | |
# uses: zyxkad/upload-release-asset-dir@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_dir: ./cert | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- create_release | |
- test | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
cache-dependency-path: ./go.sum | |
- | |
name: Generate | |
run: go generate . | |
- | |
name: Build | |
env: | |
TAG: ${{ needs.create_release.outputs.tag }} | |
run: bash ./scripts/build.sh | |
- | |
name: Upload Release Assets | |
uses: zyxkad/upload-release-asset-dir@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_dir: ./output | |
build-windows: | |
runs-on: windows-2022 | |
needs: | |
- create_release | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
cache-dependency-path: ./go.sum | |
- | |
name: Generate | |
run: go generate . | |
- | |
name: Test | |
run: go test -v ./... | |
- | |
name: Run build-windows.exe | |
env: | |
TAG: ${{ needs.create_release.outputs.tag }} | |
CODE_SIGN_PFX: ${{ secrets.CODE_SIGN_PFX }} | |
CODE_SIGN_PFX_PASSWORD: ${{ secrets.CODE_SIGN_PFX_PASSWORD }} | |
run: go run ./scripts/build-windows.go | |
- | |
name: Upload Release Assets | |
uses: zyxkad/upload-release-asset-dir@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_dir: ./output | |
build-docker: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- test | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Get current tag | |
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- | |
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: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
craftmine/go-openbmclapi:latest | |
craftmine/go-openbmclapi:${{env.TAG}} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |