migrate build distros to GHA

Signed-off-by: Dan Bond <danbond@protonmail.com>
pull/16669/head
Dan Bond 2023-03-17 11:11:50 -07:00
parent 724b752ca7
commit bc70de1cf7
No known key found for this signature in database
GPG Key ID: FEAC7C1EA83DE88F
2 changed files with 66 additions and 23 deletions

43
.github/workflows/build-distros.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: build-distros
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
tags: ["*"]
jobs:
build-386:
strategy:
matrix:
os: ['freebsd', 'linux', 'windows']
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
with:
go-version-file: 'go.mod'
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=386 CGO_ENABLED=0 go build
build-amd64:
strategy:
matrix:
os: ['darwin', 'freebsd', 'linux', 'solaris', 'windows']
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
with:
go-version-file: 'go.mod'
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=amd64 CGO_ENABLED=0 go build
build-arm:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
with:
go-version-file: 'go.mod'

View File

@ -22,7 +22,7 @@ jobs:
pre-version: ${{ steps.set-product-version.outputs.prerelease-product-version }} pre-version: ${{ steps.set-product-version.outputs.prerelease-product-version }}
shared-ldflags: ${{ steps.shared-ldflags.outputs.shared-ldflags }} shared-ldflags: ${{ steps.shared-ldflags.outputs.shared-ldflags }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: set product version - name: set product version
id: set-product-version id: set-product-version
uses: hashicorp/actions-set-product-version@v1 uses: hashicorp/actions-set-product-version@v1
@ -60,7 +60,7 @@ jobs:
filepath: ${{ steps.generate-metadata-file.outputs.filepath }} filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
steps: steps:
- name: 'Checkout directory' - name: 'Checkout directory'
uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Generate metadata file - name: Generate metadata file
id: generate-metadata-file id: generate-metadata-file
uses: hashicorp/actions-generate-metadata@v1 uses: hashicorp/actions-generate-metadata@v1
@ -68,7 +68,7 @@ jobs:
version: ${{ needs.set-product-version.outputs.product-version }} version: ${{ needs.set-product-version.outputs.product-version }}
product: ${{ env.PKG_NAME }} product: ${{ env.PKG_NAME }}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@3.1.2
with: with:
name: metadata.json name: metadata.json
path: ${{ steps.generate-metadata-file.outputs.filepath }} path: ${{ steps.generate-metadata-file.outputs.filepath }}
@ -92,10 +92,10 @@ jobs:
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Setup with node and yarn - name: Setup with node and yarn
uses: actions/setup-node@v3 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with: with:
node-version: '14' node-version: '14'
cache: 'yarn' cache: 'yarn'
@ -157,13 +157,13 @@ jobs:
echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV
echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@3.1.2
if: ${{ matrix.goos == 'linux' }} if: ${{ matrix.goos == 'linux' }}
with: with:
name: ${{ env.RPM_PACKAGE }} name: ${{ env.RPM_PACKAGE }}
path: out/${{ env.RPM_PACKAGE }} path: out/${{ env.RPM_PACKAGE }}
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@3.1.2
if: ${{ matrix.goos == 'linux' }} if: ${{ matrix.goos == 'linux' }}
with: with:
name: ${{ env.DEB_PACKAGE }} name: ${{ env.DEB_PACKAGE }}
@ -181,10 +181,10 @@ jobs:
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Setup with node and yarn - name: Setup with node and yarn
uses: actions/setup-node@v3 uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # pin@v3.6.0
with: with:
node-version: '14' node-version: '14'
cache: 'yarn' cache: 'yarn'
@ -232,7 +232,7 @@ jobs:
version: ${{needs.set-product-version.outputs.product-version}} version: ${{needs.set-product-version.outputs.product-version}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
# Strip everything but MAJOR.MINOR from the version string and add a `-dev` suffix # Strip everything but MAJOR.MINOR from the version string and add a `-dev` suffix
# This naming convention will be used ONLY for per-commit dev images # This naming convention will be used ONLY for per-commit dev images
@ -266,7 +266,7 @@ jobs:
version: ${{needs.set-product-version.outputs.product-version}} version: ${{needs.set-product-version.outputs.product-version}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: hashicorp/actions-docker-build@v1 - uses: hashicorp/actions-docker-build@v1
with: with:
version: ${{env.version}} version: ${{env.version}}
@ -286,7 +286,7 @@ jobs:
version: ${{needs.set-product-version.outputs.product-version}} version: ${{needs.set-product-version.outputs.product-version}}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
# Strip everything but MAJOR.MINOR from the version string and add a `-dev` suffix # Strip everything but MAJOR.MINOR from the version string and add a `-dev` suffix
# This naming convention will be used ONLY for per-commit dev images # This naming convention will be used ONLY for per-commit dev images
@ -323,15 +323,15 @@ jobs:
name: Verify ${{ matrix.arch }} linux binary name: Verify ${{ matrix.arch }} linux binary
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Download ${{ matrix.arch }} zip - name: Download ${{ matrix.arch }} zip
uses: actions/download-artifact@v3 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # pin@v3.0.2
with: with:
name: ${{ env.zip_name }} name: ${{ env.zip_name }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2.1.0
if: ${{ matrix.arch == 'arm' || matrix.arch == 'arm64' }} if: ${{ matrix.arch == 'arm' || matrix.arch == 'arm64' }}
with: with:
# this should be a comma-separated string as opposed to an array # this should be a comma-separated string as opposed to an array
@ -353,10 +353,10 @@ jobs:
name: Verify amd64 darwin binary name: Verify amd64 darwin binary
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Download amd64 darwin zip - name: Download amd64 darwin zip
uses: actions/download-artifact@v3 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # pin@v3.0.2
with: with:
name: ${{ env.zip_name }} name: ${{ env.zip_name }}
@ -380,7 +380,7 @@ jobs:
name: Verify ${{ matrix.arch }} debian package name: Verify ${{ matrix.arch }} debian package
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Set package version - name: Set package version
run: | run: |
@ -391,12 +391,12 @@ jobs:
echo "pkg_name=consul_${{ env.pkg_version }}-1_${{ matrix.arch }}.deb" >> $GITHUB_ENV echo "pkg_name=consul_${{ env.pkg_version }}-1_${{ matrix.arch }}.deb" >> $GITHUB_ENV
- name: Download workflow artifacts - name: Download workflow artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # pin@v3.0.2
with: with:
name: ${{ env.pkg_name }} name: ${{ env.pkg_name }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2.1.0
with: with:
platforms: all platforms: all
@ -417,7 +417,7 @@ jobs:
name: Verify ${{ matrix.arch }} rpm name: Verify ${{ matrix.arch }} rpm
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- name: Set package version - name: Set package version
run: | run: |
@ -428,12 +428,12 @@ jobs:
echo "pkg_name=consul-${{ env.pkg_version }}-1.${{ matrix.arch }}.rpm" >> $GITHUB_ENV echo "pkg_name=consul-${{ env.pkg_version }}-1.${{ matrix.arch }}.rpm" >> $GITHUB_ENV
- name: Download workflow artifacts - name: Download workflow artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # pin@v3.0.2
with: with:
name: ${{ env.pkg_name }} name: ${{ env.pkg_name }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2.1.0
with: with:
platforms: all platforms: all