Merge pull request #429 from openziti/tidy-build-workflow

tidy build workflow
This commit is contained in:
Kenneth Bingham 2023-10-27 18:59:10 -04:00 committed by GitHub
commit 2af4f8ef58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,22 +27,29 @@ jobs:
with: with:
node-version: 18.x node-version: 18.x
- run: npm install - name: install ui node modules
shell: bash
run: npm install
working-directory: ui working-directory: ui
- run: npm run build - name: build node ui
shell: bash
run: npm run build
working-directory: ui working-directory: ui
env: env:
CI: "true" CI: "true"
- name: go install - name: go install
shell: bash
run: go install -ldflags "-X github.com/openziti/zrok/build.Version=${{ github.ref }} -X github.com/openziti/zrok/build.Hash=${{ github.sha }}" ./... run: go install -ldflags "-X github.com/openziti/zrok/build.Version=${{ github.ref }} -X github.com/openziti/zrok/build.Hash=${{ github.sha }}" ./...
- name: test - name: go test
shell: bash
run: go test -v ./... run: go test -v ./...
- name: solve GOBIN - name: solve GOBIN
id: solve_go_bin id: solve_go_bin
shell: bash
run: | run: |
echo DEBUG: go_path="$(go env GOPATH)" echo DEBUG: go_path="$(go env GOPATH)"
echo go_bin="$(go env GOPATH)/bin" >> $GITHUB_OUTPUT echo go_bin="$(go env GOPATH)/bin" >> $GITHUB_OUTPUT
@ -53,6 +60,7 @@ jobs:
name: linux-amd64 name: linux-amd64
path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok
if-no-files-found: error if-no-files-found: error
# build a release candidate container image for branches named "main" or like "v*" # build a release candidate container image for branches named "main" or like "v*"
rc-container-build: rc-container-build:
needs: ubuntu-build needs: ubuntu-build
@ -62,6 +70,7 @@ jobs:
steps: steps:
- name: Set a container image tag from the branch name - name: Set a container image tag from the branch name
id: slug id: slug
shell: bash
run: | run: |
echo branch_tag=$(sed 's/[^a-z0-9_-]/__/gi' <<< "${GITHUB_REF#refs/heads/}") >> $GITHUB_OUTPUT echo branch_tag=$(sed 's/[^a-z0-9_-]/__/gi' <<< "${GITHUB_REF#refs/heads/}") >> $GITHUB_OUTPUT
@ -94,11 +103,10 @@ jobs:
ZROK_CONTAINER_IMAGE_REPO: ${{ vars.ZROK_CONTAINER_IMAGE_REPO || 'openziti/zrok' }} ZROK_CONTAINER_IMAGE_REPO: ${{ vars.ZROK_CONTAINER_IMAGE_REPO || 'openziti/zrok' }}
ZROK_CONTAINER_IMAGE_TAG: ${{ steps.slug.outputs.branch_tag }} ZROK_CONTAINER_IMAGE_TAG: ${{ steps.slug.outputs.branch_tag }}
id: tagprep_cli id: tagprep_cli
shell: bash
run: | run: |
DOCKER_TAGS="" echo DOCKER_TAGS="${ZROK_CONTAINER_IMAGE_REPO}:${ZROK_CONTAINER_IMAGE_TAG}" \
DOCKER_TAGS="${ZROK_CONTAINER_IMAGE_REPO}:${ZROK_CONTAINER_IMAGE_TAG}" | tee -a $GITHUB_OUTPUT
echo "DEBUG: DOCKER_TAGS=${DOCKER_TAGS}"
echo DOCKER_TAGS="${DOCKER_TAGS}" >> $GITHUB_OUTPUT
- name: Build & Push Linux AMD64 CLI Container Image to Hub - name: Build & Push Linux AMD64 CLI Container Image to Hub
uses: docker/build-push-action@v3 uses: docker/build-push-action@v3