Skip to content

Initial commit

Initial commit #1

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Build Go executable and submit it to API
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-22.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
outputs:
artifact-url: ${{ steps.artifact-upload.outputs.artifact-url }}
steps:
- uses: actions/checkout@v3
if: ${{ env.GITHUB_PAT != '' }}
- name: Set up Go
uses: actions/setup-go@v4
if: ${{ env.GITHUB_PAT != '' }}
with:
go-version: '1.20'
- name: Build
if: ${{ env.GITHUB_PAT != '' }}
run: go build ./...
- name: Upload build artifact
id: artifact-upload
uses: actions/[email protected]
if: ${{ env.GITHUB_PAT != '' }}
with:
path: '.'
if-no-files-found: error
retention-days: 1
overwrite: true
- name: Dump artifact url
if: ${{ env.GITHUB_PAT != '' }}
env:
ARTIFACT_URL: ${{ steps.artifact-upload.outputs.artifact-url }}
run: echo "Artifact URL => $ARTIFACT_URL"
upload:
needs: build
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
runs-on: ubuntu-22.04
steps:
- name: Submit build artifact to CKB
uses: dkershner6/post-api-call-action@v2
if: ${{ env.GITHUB_PAT != '' }}
with:
url: ${{ vars.API_BASE_URL }}/battles/${{ vars.BATTLE_ID }}/submit
data: "{\"artifactUrl\": \"${{ needs.build.outputs.artifact-url }}\"}"
headers: "{\"Authorization\": \"Bearer ${{ secrets.GITHUB_PAT }}\"}"