Skip to content

Commit a045e49

Browse files
committed
Fixed it so the CI build UI
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
1 parent 2e53a65 commit a045e49

File tree

15 files changed

+16734
-198
lines changed

15 files changed

+16734
-198
lines changed

.github/actions/amazon-linux-build-action/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
cd cmd/tegola_lambda
2020

2121
# build the binary
22-
go build -mod vendor -ldflags "-w -X main.Version=$VERSION"
22+
go build -mod vendor -ldflags "-w -X ${BuildPkg}.Version=${VERSION} -X ${BuildPkg}.GitRevision=${GIT_REVISION} -X ${BuildPkg}.GitBranch=${GIT_BRANCH}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'setup base env'
2+
description: "setup base environment for build tegola"
3+
inputs:
4+
ui:
5+
description: 'Download UI'
6+
required: false
7+
default: 'false'
8+
go:
9+
description: 'Download install go'
10+
required: false
11+
default: 'true'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v2
18+
19+
- name: Download version artifact
20+
uses: actions/download-artifact@v1
21+
with:
22+
name: version
23+
24+
- name: Download ui artifact
25+
uses: actions/download-artifact@v1
26+
with:
27+
name: ui
28+
path: ${{ github.workspace }}/ui/dist
29+
if: ${{ inputs.ui == 'true' }}
30+
31+
- name: Set up Go 1.18
32+
uses: actions/setup-go@v2
33+
with:
34+
go-version: 1.18
35+
if: ${{ inputs.go == 'true' }}
36+
37+
- name: Set tegola version
38+
run: go run ci/cat_version_envs.go -version_file version/version.txt >> $GITHUB_ENV
39+
shell: bash
40+
41+
- name: Download default-branch-ref artifact
42+
uses: actions/download-artifact@v1
43+
with:
44+
name: default-branch-ref
45+
46+
- name: Set tegola default branch ref
47+
run: echo "DEFAULT_BRANCH_REF=$(cat default-branch-ref/default-branch-ref.txt)" >> $GITHUB_ENV
48+
shell: bash
49+
50+
- name: Say goodbye
51+
run: echo "goodbye! ${{ runner.os }} ${{ runner.arch }}"
52+
shell: bash
53+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: tegola-upload-path
2+
description: "returns the correct upload path for os"
3+
inputs:
4+
name:
5+
description: "base dir name"
6+
default: "tegola"
7+
required: false
8+
9+
outputs:
10+
dir-path:
11+
description: "dir path for tegola"
12+
value: ${{ steps.compute-path.outputs.dir-path }}
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: set env (not Windows)
18+
run: echo "TEGOLA_PATH=cmd/${{inputs.name}}/" >> $GITHUB_ENV
19+
shell: bash
20+
if: ${{ runner.os != 'Windows' }}
21+
- name: set env (Windows)
22+
run: echo "TEGOLA_PATH=cmd\\${{inputs.name}}\\" >> $GITHUB_ENV
23+
shell: bash
24+
if: ${{ runner.os == 'Windows' }}
25+
- id: compute-path
26+
run: echo "::set-output name=dir-path::${TEGOLA_PATH}"
27+
shell: bash
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: upload artifact
2+
description: "upload generated artifacts including release"
3+
inputs:
4+
artifact_name:
5+
description: "name of the artifact"
6+
default: "tegola"
7+
required: false
8+
upload_postfix:
9+
description: "uploaded name of the artifact"
10+
default: "linux_amd64"
11+
required: false
12+
github_token:
13+
description: "github token"
14+
required: true
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- id: zip-path
20+
uses: ./.github/actions/tegola_upload_path
21+
with:
22+
name: ${{ inputs.artifact_name }}
23+
24+
# workaround for archives losing permissions
25+
# https://github.com/actions/upload-artifact/issues/38
26+
- name: Zip (not windows)
27+
run: |
28+
cd ${{steps.zip-path.outputs.dir-path}}
29+
zip -9 -D tegola.zip ${{inputs.artifact_name}}
30+
shell: bash
31+
if: ${{ runner.os != 'Windows' }}
32+
33+
- name: Zip (windows)
34+
run: |
35+
cd ${{steps.zip-path.outputs.dir-path}}
36+
7z a tegola.zip ${{inputs.artifact_name}}.exe
37+
shell: pwsh
38+
if: ${{ runner.os == 'Windows' }}
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: ${{inputs.artifact_name}}${{inputs.upload_postfix}}
44+
path: ${{steps.zip-path.outputs.dir-path}}tegola.zip
45+
46+
- name: Upload release asset
47+
if: github.event_name == 'release'
48+
uses: actions/upload-release-asset@v1
49+
env:
50+
GITHUB_TOKEN: ${{ inputs.github_token }}
51+
with:
52+
upload_url: ${{ github.event.release.upload_url }}
53+
asset_path: ${{steps.zip-path.outputs.dir-path}}tegola.zip
54+
asset_name: ${{inputs.artifact_name}}${{inputs.upload_postfix}}.zip
55+
asset_content_type: application/zip

.github/workflows/on_pr_push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ jobs:
100100
go install -mod=vendor github.com/mattn/goveralls
101101
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
102102
103-
- name: Build embeded UI
103+
- name: Build embedded UI
104104
run: |
105105
pushd ${GITHUB_WORKSPACE}/server
106106
go generate ./...

0 commit comments

Comments
 (0)