Implement matrix strategy to build for different combinations of oper… #8
Workflow file for this run
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: Create release | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [1.16] | ||
os: [linux, darwin] | ||
arch: [amd64, arm64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Build | ||
run: | | ||
mkdir -p build | ||
CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go build -a -ldflags '-w -extldflags "-static"' -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o build/orchent-${{ matrix.arch }}-linux orchent.go | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=${{ matrix.arch }} go build -a -ldflags '-w -extldflags "-static"' -o build/orchent-${{ matrix.arch }}-darwin orchent.go | ||
- name: Prepare packages | ||
run: | | ||
mkdir -p .debpkg/usr/bin | ||
cp build/orchent-${{ matrix.arch }}-linux .debpkg/usr/bin/orchent | ||
chmod +x .debpkg/usr/bin/orchent | ||
mkdir -p .rpmpkg/usr/bin | ||
cp build/orchent-${{ matrix.arch }}-linux .rpmpkg/usr/bin/orchent | ||
chmod +x .rpmpkg/usr/bin/orchent | ||
- name: Set rpm version | ||
run: | | ||
Check failure on line 42 in .github/workflows/release.yaml GitHub Actions / Create releaseInvalid workflow file
|
||
rpm_version="${{ github.ref/-/. }}" | ||
echo $rpm_version | ||
echo "REF=$rpm_version" >> $GITHUB_ENV | ||
env: | ||
github_ref: ${{ github.ref }} | ||
- name: Create deb package | ||
uses: jiro4989/build-deb-action@v2 | ||
with: | ||
package: orchent | ||
package_root: .debpkg | ||
maintainer: Marica Antonacci <marica.antonacci@ba.infn.it> | ||
version: ${{ github.ref }} | ||
arch: ${{ matrix.arch }} | ||
desc: 'orchent cli' | ||
- name: Create rpm package | ||
uses: jiro4989/build-rpm-action@v2 | ||
with: | ||
summary: 'orchent cli' | ||
package: orchent | ||
package_root: .rpmpkg | ||
maintainer: Marica Antonacci <marica.antonacci@ba.infn.it> | ||
version: ${{ env.REF }} | ||
arch: 'x86_64' | ||
desc: 'orchent cli' | ||
- name: debug | ||
run: | | ||
ls -latr | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
#if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
body_path: CHANGELOG.md | ||
draft: true | ||
files: | | ||
*.deb | ||
*.rpm | ||
build/orchent-${{ matrix.arch }}-darwin |