build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 in /ui #804
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: On release publish | |
on: | |
push: | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
gen_version: | |
name: Generate software version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
# on release, we want to use release.tag_name for the version | |
- name: Set tegola version (use release.tag_name) | |
if: github.event_name == 'release' | |
run: echo ${{ github.event.release.tag_name }} > ${{ github.workspace }}/version.txt | |
# when it's not a release build use the commit hash for the version tag | |
- name: Set tegola version (use commit hash) | |
if: github.event_name != 'release' | |
run: echo ${{ github.sha }} | cut -c1-7 > ${{ github.workspace }}/version.txt | |
- name: Upload build artifact version | |
uses: actions/upload-artifact@v2 | |
with: | |
name: version | |
path: ${{ github.workspace }}/version.txt | |
# when it's not a release, but we want to perform an action on a new push/pr to default branch | |
# we need the default branch ref, which in case of tegola changes with the version | |
- name: Get tegola default branch ref | |
run: | | |
DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}') | |
echo "DEFAULT_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_ENV | |
echo "refs/heads/$DEFAULT_BRANCH" > ${{ github.workspace }}/default-branch-ref.txt | |
- name: Upload build artifacts default branch ref | |
uses: actions/upload-artifact@v2 | |
with: | |
name: default-branch-ref | |
path: ${{ github.workspace }}/default-branch-ref.txt | |
build_ui: | |
name: Build for embedded ui | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.20.5 | |
- name: Build embedded UI | |
run: | | |
pushd ${GITHUB_WORKSPACE}/server | |
go generate ./... | |
popd | |
- name: Upload build artifact version | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ui | |
path: ${{ github.workspace }}/ui/dist | |
build_linux: | |
name: Build for Linux and AWS Lambda | |
needs: [gen_version,build_ui] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out actions | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/tegola-setup-env | |
with: | |
ui: true | |
- name: Build for Linux | |
env: | |
# build architecture | |
GOOS: linux | |
run: | | |
cd cmd/tegola | |
go build -mod vendor -ldflags "-w -X ${BUILD_PKG}.Version=${VERSION} -X ${BUILD_PKG}.GitRevision=${GIT_REVISION} -X ${BUILD_PKG}.GitBranch=${GIT_BRANCH}" | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
artifact_name: "tegola" | |
upload_postfix: "_linux_amd64" | |
build_tegola_lambda: | |
name: Build tegola_lambda on Amazon Linux | |
needs: [gen_version] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out actions | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/tegola-setup-env | |
with: | |
ui: false | |
go: false | |
- name: Build tegola_lambda | |
uses: ./.github/actions/amazon-linux-build-action | |
with: | |
args: '...' | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
artifact_name: "tegola_lambda" | |
upload_postfix: "" | |
build_macos: | |
name: Build for MacOS | |
needs: [gen_version,build_ui] | |
runs-on: macos-latest | |
steps: | |
- name: Check out actions | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/tegola-setup-env | |
with: | |
ui: true | |
- name: Build for Darwin | |
env: | |
GOOS: darwin | |
run: | | |
cd cmd/tegola | |
go build -mod vendor -ldflags "-w -X ${BUILD_PKG}.Version=${VERSION} -X ${BUILD_PKG}.GitRevision=${GIT_REVISION} -X ${BUILD_PKG}.GitBranch=${GIT_BRANCH}" | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
artifact_name: "tegola" | |
upload_postfix: "_darwin_amd64" | |
build_docker: | |
name: Build Docker image and publish to Docker Hub | |
needs: [gen_version,build_ui] | |
runs-on: ubuntu-22.04 | |
env: | |
DOCKERHUB_ORG: gospatial | |
DOCKERHUB_REPO: tegola | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/tegola-setup-env | |
with: | |
ui: true | |
- name: Build and tag Docker container | |
run: | | |
docker build -t tegola --build-arg BUILDPKG=${BUILD_PKG} --build-arg VER=${VERSION} --build-arg BRANCH=${GIT_BRANCH} --build-arg REVISION=${GIT_REVISION} . | |
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION} | |
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest | |
docker tag tegola:latest ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge | |
docker run --rm tegola version | |
- name: Publish Docker edge container | |
if: github.ref == env.DEFAULT_BRANCH_REF | |
env: | |
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin | |
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:edge | |
- name: Publish Docker container | |
if: github.event_name == 'release' | |
env: | |
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USER} --password-stdin | |
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:${VERSION} | |
docker push ${DOCKERHUB_ORG}/${DOCKERHUB_REPO}:latest | |
build_windows: | |
name: Build for Windows | |
needs: [gen_version,build_ui] | |
runs-on: windows-latest | |
steps: | |
- name: Check out actions | |
uses: actions/checkout@v3 | |
- name: Setup env | |
uses: ./.github/actions/tegola-setup-env | |
with: | |
ui: true | |
- name: Build for Windows | |
run: | | |
cd cmd\tegola | |
go build -ldflags "-w -X $Env:BUILD_PKG.Version=$Env:VERSION -X $Env:BUILD_PKG.GitRevision=$Env:GIT_REVISION -X $Env:BUILD_PKG.GitBranch=$Env:GIT_BRANCH" | |
- name: Upload artifact | |
uses: ./.github/actions/upload-artifact | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
artifact_name: "tegola" | |
upload_postfix: "_windows_amd64" |