Skip to content

Commit

Permalink
new build chenages
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Ghazaryan committed Jun 9, 2024
1 parent ea33908 commit 2e7a578
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,51 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: -1
fetch-depth: 0

- name: Build πŸ—οΈ
id: build
uses: szkiba/xk6bundler@v0
with:
platform: linux/amd64 windows/amd64 darwin/amd64
with: |
github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
- name: Install Go πŸ§‘β€πŸ’»
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Generate dependencies list
run: go list -m all > go.list

- name: Install SPDX tool
run: go install github.com/spdx/tools-golang/bom/cmd/rdf2v1@latest

go-version: "1.22"

- name: Generate SBOM
run: rdf2v1 -format tagvalue go.list > sbom.spdx

- name: Upload SPDX SBOM artifact for go.mod πŸ’Ύ
- name: Install xk6 and build xk6-mongo for different platforms πŸ—οΈ
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: actions/upload-artifact@v3
with:
name: sbom.spdx
path: sbom.spdx
run: |
mkdir dist
go install go.k6.io/xk6/cmd/xk6@latest
# ------------------------- Linux amd64 -------------------------
GOOS=linux GOARCH=amd64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_linux_amd64 --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_linux_amd64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_linux_amd64
# ------------------------- Linux arm64 -------------------------
GOOS=linux GOARCH=arm64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_linux_arm64 --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_linux_arm64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_linux_arm64
# ------------------------- macOS amd64 -------------------------
GOOS=darwin GOARCH=amd64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_darwin_amd64 --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_darwin_amd64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_darwin_amd64
# ------------------------- macOS arm64 -------------------------
GOOS=darwin GOARCH=arm64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_darwin_arm64 --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_darwin_arm64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_darwin_arm64
# ------------------------- Windows amd64 -------------------------
GOOS=windows GOARCH=amd64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_windows_amd64.exe --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_windows_amd64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_windows_amd64.exe
# ------------------------- Windows arm64 -------------------------
GOOS=windows GOARCH=arm64 xk6 build --output dist/xk6-mongo_${{ github.ref_name }}_windows_arm64.exe --with github.com/GhMartingit/xk6-mongo@${{ github.ref_name }}
tar cvzf dist/xk6-mongo_${{ github.ref_name }}_windows_arm64.tar.gz dist/xk6-mongo_${{ github.ref_name }}_windows_arm64.exe
- name: Generate CycloneDX SBOM artifacts πŸ“ƒ
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@latest
cyclonedx-gomod mod -json -licenses -output code-cyclonedx-xk6-mongo-${{ github.ref_name }}.json
- name: Create Release πŸ“¦
- name: Create Release πŸ“¦ and add binaries and SBOM files πŸ’Ύ
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
with:
files: dist/*.tar.gz
files: |
dist/*.tar.gz
code-cyclonedx-xk6-kafka-${{ github.ref_name }}.json
docker-image-cyclonedx-xk6-kafka-${{ github.ref_name }}.json

0 comments on commit 2e7a578

Please sign in to comment.