2021-12-06 16:06:22 +00:00
|
|
|
name: build
|
|
|
|
|
2022-05-13 15:21:15 +00:00
|
|
|
on: [ workflow_dispatch, push ]
|
2021-12-06 16:06:22 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
PKG_NAME: "vault"
|
|
|
|
GO_TAGS: "ui"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
get-product-version:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
product-version: ${{ steps.get-product-version.outputs.product-version }}
|
2022-02-24 19:57:40 +00:00
|
|
|
product-base-version: ${{ steps.get-product-version.outputs.product-base-version }}
|
2021-12-06 16:06:22 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: get product version
|
|
|
|
id: get-product-version
|
|
|
|
run: |
|
|
|
|
make version
|
2022-02-24 19:57:40 +00:00
|
|
|
IFS="-" read BASE_VERSION _other <<< "$(make version)"
|
2021-12-06 16:06:22 +00:00
|
|
|
echo "::set-output name=product-version::$(make version)"
|
2022-02-24 19:57:40 +00:00
|
|
|
echo "::set-output name=product-base-version::${BASE_VERSION}"
|
2021-12-15 19:38:20 +00:00
|
|
|
|
2022-04-19 18:28:08 +00:00
|
|
|
get-build-date:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
build-date: ${{ steps.get-build-date.outputs.build-date }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: get build date
|
|
|
|
id: get-build-date
|
|
|
|
run: |
|
|
|
|
make build-date
|
|
|
|
echo "::set-output name=build-date::$(make build-date)"
|
|
|
|
|
2021-12-06 16:06:22 +00:00
|
|
|
generate-metadata-file:
|
|
|
|
needs: get-product-version
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
|
|
steps:
|
|
|
|
- name: 'Checkout directory'
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Generate metadata file
|
|
|
|
id: generate-metadata-file
|
2022-04-22 18:15:09 +00:00
|
|
|
uses: hashicorp/actions-generate-metadata@v1
|
2021-12-06 16:06:22 +00:00
|
|
|
with:
|
|
|
|
version: ${{ needs.get-product-version.outputs.product-version }}
|
|
|
|
product: ${{ env.PKG_NAME }}
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: metadata.json
|
|
|
|
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
|
|
|
|
|
|
build-other:
|
2022-04-19 18:28:08 +00:00
|
|
|
needs: [ get-product-version, get-build-date ]
|
2021-12-06 16:06:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
goos: [ freebsd, windows, netbsd, openbsd, solaris ]
|
|
|
|
goarch: [ "386", "amd64", "arm" ]
|
2022-04-14 18:41:05 +00:00
|
|
|
go: [ "1.17.9" ]
|
2021-12-06 16:06:22 +00:00
|
|
|
exclude:
|
|
|
|
- goos: solaris
|
|
|
|
goarch: 386
|
|
|
|
- goos: solaris
|
|
|
|
goarch: arm
|
|
|
|
- goos: windows
|
|
|
|
goarch: arm
|
|
|
|
fail-fast: true
|
|
|
|
|
|
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Setup node and yarn
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
cache: 'yarn'
|
|
|
|
cache-dependency-path: 'ui/yarn.lock'
|
|
|
|
- name: UI Build
|
|
|
|
run: |
|
|
|
|
cd ui
|
|
|
|
yarn install --ignore-optional
|
|
|
|
npm rebuild node-sass
|
|
|
|
yarn --verbose run build
|
|
|
|
cd ..
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
run: |
|
|
|
|
mkdir dist out
|
2022-04-19 18:28:08 +00:00
|
|
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
|
2021-12-06 16:06:22 +00:00
|
|
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
|
|
|
|
build-linux:
|
2022-04-19 18:28:08 +00:00
|
|
|
needs: [ get-product-version, get-build-date ]
|
2021-12-06 16:06:22 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
goos: [linux]
|
|
|
|
goarch: ["arm", "arm64", "386", "amd64"]
|
2022-04-14 18:41:05 +00:00
|
|
|
go: ["1.17.9"]
|
2021-12-06 16:06:22 +00:00
|
|
|
fail-fast: true
|
|
|
|
|
|
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Setup node and yarn
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
cache: 'yarn'
|
|
|
|
cache-dependency-path: 'ui/yarn.lock'
|
|
|
|
- name: UI Build
|
|
|
|
run: |
|
|
|
|
cd ui
|
|
|
|
yarn install --ignore-optional
|
|
|
|
npm rebuild node-sass
|
|
|
|
yarn --verbose run build
|
|
|
|
cd ..
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
run: |
|
|
|
|
mkdir dist out
|
2022-04-19 18:28:08 +00:00
|
|
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
|
2021-12-06 16:06:22 +00:00
|
|
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
|
|
|
|
- name: Package
|
2022-03-23 18:45:30 +00:00
|
|
|
uses: hashicorp/actions-packaging-linux@v1
|
2021-12-06 16:06:22 +00:00
|
|
|
with:
|
|
|
|
name: ${{ github.event.repository.name }}
|
|
|
|
description: "Vault is a tool for secrets management, encryption as a service, and privileged access management."
|
|
|
|
arch: ${{ matrix.goarch }}
|
|
|
|
version: ${{ needs.get-product-version.outputs.product-version }}
|
|
|
|
maintainer: "HashiCorp"
|
|
|
|
homepage: "https://github.com/hashicorp/vault"
|
|
|
|
license: "MPL-2.0"
|
|
|
|
binary: "dist/${{ env.PKG_NAME }}"
|
|
|
|
deb_depends: "openssl"
|
|
|
|
rpm_depends: "openssl"
|
|
|
|
config_dir: ".release/linux/package/"
|
|
|
|
preinstall: ".release/linux/preinst"
|
|
|
|
postinstall: ".release/linux/postinst"
|
|
|
|
postremove: ".release/linux/postrm"
|
|
|
|
- name: Add Package names to env
|
|
|
|
run: |
|
|
|
|
echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV
|
|
|
|
echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ env.RPM_PACKAGE }}
|
|
|
|
path: out/${{ env.RPM_PACKAGE }}
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ env.DEB_PACKAGE }}
|
|
|
|
path: out/${{ env.DEB_PACKAGE }}
|
|
|
|
|
|
|
|
build-darwin:
|
2022-04-19 18:28:08 +00:00
|
|
|
needs: [ get-product-version, get-build-date ]
|
2021-12-06 16:06:22 +00:00
|
|
|
runs-on: macos-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
goos: [ darwin ]
|
|
|
|
goarch: [ "amd64", "arm64" ]
|
2022-04-14 18:41:05 +00:00
|
|
|
go: [ "1.17.9" ]
|
2021-12-06 16:06:22 +00:00
|
|
|
fail-fast: true
|
|
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
- name: Setup node and yarn
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: '14'
|
|
|
|
cache: 'yarn'
|
|
|
|
cache-dependency-path: 'ui/yarn.lock'
|
|
|
|
- name: UI Build
|
|
|
|
run: |
|
|
|
|
cd ui
|
|
|
|
yarn install --ignore-optional
|
|
|
|
npm rebuild node-sass
|
|
|
|
yarn --verbose run build
|
|
|
|
cd ..
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
GOOS: ${{ matrix.goos }}
|
|
|
|
GOARCH: ${{ matrix.goarch }}
|
2022-01-20 19:23:37 +00:00
|
|
|
GO_TAGS: "${{ env.GO_TAGS }} netcgo"
|
2021-12-06 16:06:22 +00:00
|
|
|
CGO_ENABLED: 0
|
|
|
|
run: |
|
|
|
|
mkdir dist out
|
2022-04-19 18:28:08 +00:00
|
|
|
GO_TAGS="${{ env.GO_TAGS }}" VAULT_VERSION=${{ needs.get-product-version.outputs.product-base-version }} VAULT_REVISION="$(git rev-parse HEAD)" VAULT_BUILD_DATE="${{ needs.get-build-date.outputs.build-date }}" make build
|
2021-12-06 16:06:22 +00:00
|
|
|
zip -r -j out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
path: out/${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
|
|
|
|
|
|
|
|
build-docker:
|
|
|
|
name: Docker ${{ matrix.arch }} build
|
|
|
|
needs:
|
|
|
|
- get-product-version
|
|
|
|
- build-linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch: ["arm", "arm64", "386", "amd64"]
|
|
|
|
env:
|
|
|
|
repo: ${{github.event.repository.name}}
|
|
|
|
version: ${{needs.get-product-version.outputs.product-version}}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Docker Build (Action)
|
|
|
|
uses: hashicorp/actions-docker-build@v1
|
|
|
|
with:
|
|
|
|
version: ${{env.version}}
|
|
|
|
target: default
|
|
|
|
arch: ${{matrix.arch}}
|
|
|
|
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_linux_${{ matrix.arch }}.zip
|
|
|
|
tags: |
|
|
|
|
docker.io/hashicorp/${{env.repo}}:${{env.version}}
|
2021-12-14 20:53:02 +00:00
|
|
|
public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}}
|
2022-05-13 15:21:15 +00:00
|
|
|
|
|
|
|
build-ubi:
|
|
|
|
name: Red Hat UBI ${{ matrix.arch }} build
|
|
|
|
needs:
|
|
|
|
- get-product-version
|
|
|
|
- build-linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
arch: ["amd64"]
|
|
|
|
env:
|
|
|
|
repo: ${{github.event.repository.name}}
|
|
|
|
version: ${{needs.get-product-version.outputs.product-version}}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Docker Build (Action)
|
|
|
|
uses: hashicorp/actions-docker-build@v1
|
|
|
|
with:
|
|
|
|
version: ${{env.version}}
|
|
|
|
target: ubi
|
|
|
|
arch: ${{matrix.arch}}
|
|
|
|
zip_artifact_name: ${{ env.PKG_NAME }}_${{ needs.get-product-version.outputs.product-version }}_linux_${{ matrix.arch }}.zip
|
|
|
|
redhat_tag: scan.connect.redhat.com/ospid-f0a92725-d8c6-4023-9a87-ba785b94c3fd/${{env.repo}}:${{env.version}}-ubi
|