Skip to content

Commit

Permalink
Fixed it so the CI build UI
Browse files Browse the repository at this point in the history
The UI stopped getting build by the CI. Updated the
workflow files to build the UI and upload it as an
artifact that people can use.

* Improved version command to contain additional version
information about the binary.
* Imported the workflow to reduce amount of duplicated work
* include branch name as part of version information.
* moved redundant task to local actions to improve reuse of workflow code

fixes #855
  • Loading branch information
gdey committed May 27, 2022
1 parent 2e53a65 commit 59ce439
Show file tree
Hide file tree
Showing 15 changed files with 16,738 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .github/actions/amazon-linux-build-action/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
cd cmd/tegola_lambda

# build the binary
go build -mod vendor -ldflags "-w -X main.Version=$VERSION"
go build -mod vendor -ldflags "-w -X ${BuildPkg}.Version=${VERSION} -X ${BuildPkg}.GitRevision=${GIT_REVISION} -X ${BuildPkg}.GitBranch=${GIT_BRANCH}"
53 changes: 53 additions & 0 deletions .github/actions/tegola-setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'setup base env'
description: "setup base environment for build tegola"
inputs:
ui:
description: 'Download UI'
required: false
default: 'false'
go:
description: 'Download install go'
required: false
default: 'true'

runs:
using: "composite"
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Download version artifact
uses: actions/download-artifact@v1
with:
name: version

- name: Download ui artifact
uses: actions/download-artifact@v1
with:
name: ui
path: ${{ github.workspace }}/ui/dist
if: ${{ inputs.ui == 'true' }}

- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.18
if: ${{ inputs.go == 'true' }}

- name: Set tegola version
run: go run ci/cat_version_envs.go -version_file version/version.txt | tee $GITHUB_ENV
shell: bash

- name: Download default-branch-ref artifact
uses: actions/download-artifact@v1
with:
name: default-branch-ref

- name: Set tegola default branch ref
run: echo "DEFAULT_BRANCH_REF=$(cat default-branch-ref/default-branch-ref.txt)" >> $GITHUB_ENV
shell: bash

- name: Say goodbye
run: echo "goodbye! ${{ runner.os }} ${{ runner.arch }}"
shell: bash

27 changes: 27 additions & 0 deletions .github/actions/tegola_upload_path/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: tegola-upload-path
description: "returns the correct upload path for os"
inputs:
name:
description: "base dir name"
default: "tegola"
required: false

outputs:
dir-path:
description: "dir path for tegola"
value: ${{ steps.compute-path.outputs.dir-path }}

runs:
using: "composite"
steps:
- name: set env (not Windows)
run: echo "TEGOLA_PATH=cmd/${{inputs.name}}/" >> $GITHUB_ENV
shell: bash
if: ${{ runner.os != 'Windows' }}
- name: set env (Windows)
run: echo "TEGOLA_PATH=cmd\\${{inputs.name}}\\" >> $GITHUB_ENV
shell: bash
if: ${{ runner.os == 'Windows' }}
- id: compute-path
run: echo "::set-output name=dir-path::${TEGOLA_PATH}"
shell: bash
55 changes: 55 additions & 0 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: upload artifact
description: "upload generated artifacts including release"
inputs:
artifact_name:
description: "name of the artifact"
default: "tegola"
required: false
upload_postfix:
description: "uploaded name of the artifact"
default: "linux_amd64"
required: false
github_token:
description: "github token"
required: true

runs:
using: "composite"
steps:
- id: zip-path
uses: ./.github/actions/tegola_upload_path
with:
name: ${{ inputs.artifact_name }}

# workaround for archives losing permissions
# https://github.com/actions/upload-artifact/issues/38
- name: Zip (not windows)
run: |
cd ${{steps.zip-path.outputs.dir-path}}
zip -9 -D tegola.zip ${{inputs.artifact_name}}
shell: bash
if: ${{ runner.os != 'Windows' }}

- name: Zip (windows)
run: |
cd ${{steps.zip-path.outputs.dir-path}}
7z a tegola.zip ${{inputs.artifact_name}}.exe
shell: pwsh
if: ${{ runner.os == 'Windows' }}

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{inputs.artifact_name}}${{inputs.upload_postfix}}
path: ${{steps.zip-path.outputs.dir-path}}tegola.zip

- name: Upload release asset
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{steps.zip-path.outputs.dir-path}}tegola.zip
asset_name: ${{inputs.artifact_name}}${{inputs.upload_postfix}}.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion .github/workflows/on_pr_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
go install -mod=vendor github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
- name: Build embeded UI
- name: Build embedded UI
run: |
pushd ${GITHUB_WORKSPACE}/server
go generate ./...
Expand Down
Loading

0 comments on commit 59ce439

Please sign in to comment.