chore: fix leading v in docker image tag #102
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: binaries | |
on: | |
push: | |
tags: | |
- 'v*' | |
branches: [ 'master' ] | |
pull_request: | |
branches: [ 'master' ] | |
jobs: | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: controller/web/template/dist | |
key: frontend-dist-${{ hashFiles('controller/web/template/**') }} | |
- uses: actions/setup-node@v1 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
node-version: '15.x' | |
- run: cd controller/web/template && npm ci | |
if: steps.cache.outputs.cache-hit != 'true' | |
- run: cd controller/web/template && npm run build --if-present | |
if: steps.cache.outputs.cache-hit != 'true' | |
package-templates: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
id: cache2 | |
with: | |
path: build-artifacts/templates.zip | |
key: templates-${{ hashFiles('templates/**') }} | |
- run: mkdir -p build-artifacts | |
if: steps.cache2.outputs.cache-hit != 'true' | |
- run: zip -qr build-artifacts/templates.zip templates | |
if: steps.cache2.outputs.cache-hit != 'true' | |
go-binaries: | |
runs-on: ubuntu-latest | |
needs: [ frontend, package-templates ] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: controller/web/template/dist | |
key: frontend-dist-${{ hashFiles('controller/web/template/**') }} | |
- uses: actions/cache@v2 | |
id: cache2 | |
with: | |
path: build-artifacts/templates.zip | |
key: templates-${{ hashFiles('templates/**') }} | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.17.x' | |
- run: GOOS=linux GOARCH=amd64 go build -o build-artifacts/vistecture-linux-amd64 vistecture.go | |
- run: GOOS=linux GOARCH=arm64 go build -o build-artifacts/vistecture-linux-arm64 vistecture.go | |
- run: GOOS=windows go build -o build-artifacts/vistecture.exe vistecture.go | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: binaries | |
path: build-artifacts/vistecture* | |
createRelease: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: [ go-binaries] | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Download go-binary artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries | |
path: ./ | |
- name: Upload vistecture.exe asset | |
id: upload-windows-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./vistecture.exe | |
asset_name: vistecture.exe | |
asset_content_type: application/octet-stream | |
- name: Upload vistecture linux asset | |
id: upload-linux-asset-amd64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./vistecture-linux-amd64 | |
asset_name: vistecture-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload vistecture linux asset | |
id: upload-linux-asset-arm64 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./vistecture-linux-arm64 | |
asset_name: vistecture-arm64 | |
asset_content_type: application/octet-stream | |
docker: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
needs: [ go-binaries ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Download go-binary artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries | |
path: build-artifacts | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up ref without leading 'v' | |
run: echo "STRIPPED_REF_NAME=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: .github/Dockerfile | |
push: true | |
tags: aoepeople/vistecture:${{ env.STRIPPED_REF_NAME }} | |
platforms: linux/amd64,linux/arm64 |