-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: DO-2153 Create Artifacts for PR (#1306)
* only run for PRs to main * using goreleaser * updated main to use go releaser * remove working dir * fetch-depth: 0 * adding goreleaser config files * added docker * added config to lavap and visor * added nfpms * added id and binary * update pipeline * --skip=validate * no need for both snapshot and skip * use: buildx * update config * rename workflow files * update job name * matrix strategy * running on macos as well * artifact names * fronJson * naming * windows-latest * update goreleasr files * update releaser files * remove packages * test releaser path * relative * cmd/lavad * remove checkout 0 and upload * remove redundant test * remove test * using goreleasre * added bot integ * put checkout first * pipeline name change * dockerilfe * comment docker creation * remove wip dockerfile * upload pr binaries * naming * artifactgs * 0 --------- Co-authored-by: amitz <amitz@sepiocyber.com>
- Loading branch information
Showing
10 changed files
with
523 additions
and
130 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,6 @@ ecosystem/**/package-lock.json | |
.git/ | ||
.idea/ | ||
.vscode/ | ||
.storage/ | ||
.storage/ | ||
|
||
Dockerfile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ue | ||
|
||
SEMVER_REGEX='^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' | ||
|
||
REL_VERSION=`echo $1 | sed -r 's/^[vV]?([0-9].+)$/\1/'` | ||
|
||
if [ `echo $REL_VERSION | pcre2grep "$SEMVER_REGEX"` ]; then | ||
echo "$REL_VERSION is a valid semantic version." | ||
else | ||
echo "$REL_VERSION is not a valid semantic version." | ||
exit 1 | ||
fi | ||
|
||
MAJOR_MINOR_VERSION=`echo $REL_VERSION | cut -d. -f1,2` | ||
RELEASE_BRANCH="release-$MAJOR_MINOR_VERSION" | ||
RELEASE_TAG="v$REL_VERSION" | ||
|
||
if [ `git rev-parse --verify origin/$RELEASE_BRANCH 2>/dev/null` ]; then | ||
echo "$RELEASE_BRANCH branch already exists, checking it out ..." | ||
git checkout $RELEASE_BRANCH | ||
else | ||
echo "$RELEASE_BRANCH does not exist, creating ..." | ||
git checkout -b $RELEASE_BRANCH | ||
git push origin $RELEASE_BRANCH | ||
fi | ||
echo "$RELEASE_BRANCH branch is ready." | ||
|
||
if [ `git rev-parse --verify $RELEASE_TAG 2>/dev/null` ]; then | ||
echo "$RELEASE_TAG tag already exists, aborting ..." | ||
exit 2 | ||
fi | ||
|
||
echo "Tagging $RELEASE_TAG ..." | ||
git tag $RELEASE_TAG | ||
echo "$RELEASE_TAG is tagged." | ||
|
||
echo "Pushing $RELEASE_TAG tag ..." | ||
git push origin $RELEASE_TAG | ||
echo "$RELEASE_TAG tag is pushed." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Create a release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
rel_version: | ||
description: 'Release version (examples: v1.3.0-rc.1, v1.3.0)' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
create-release: | ||
name: Creates release branch and tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install required packages | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install pcre2-utils | ||
- name: Create release branch and tag | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.LAVANET_BOT_TOKEN }} | ||
run: | | ||
git config user.email "bot@lavanet.xyz" | ||
git config user.name "LavaNet Bot" | ||
# Update origin with token | ||
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | ||
./.github/scripts/create-release.sh ${{ inputs.rel_version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Lava | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
matrix: | ||
binary: [lavad, lavap, lavavisor] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.20.5 | ||
go-version-file: go.mod | ||
cache-dependency-path: go.sum | ||
|
||
- name: Run GoReleaser | ||
id: releaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: build --single-target --snapshot --clean | ||
workdir: cmd/${{ matrix.binary }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goos }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goarch }} | ||
path: cmd/${{ matrix.binary }}/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} | ||
|
||
# - name: Docker meta | ||
# id: meta | ||
# uses: docker/metadata-action@v5 | ||
# with: | ||
# images: | | ||
# lava/${{ matrix.binary }} | ||
# ghcr.io/lavanet/${{ matrix.binary }} | ||
# tags: | | ||
# type=raw,value=latest,enable={{is_default_branch}} | ||
# type=schedule | ||
# type=ref,event=branch | ||
# type=ref,event=pr | ||
# type=semver,pattern={{version}} | ||
# type=semver,pattern={{major}}.{{minor}} | ||
# type=semver,pattern={{major}} | ||
# type=sha | ||
# - name: Set up QEMU | ||
# uses: docker/setup-qemu-action@v3 | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v3 | ||
# - name: Build and push | ||
# uses: docker/build-push-action@v5 | ||
# with: | ||
# context: . | ||
# push: ${{ github.event_name != 'pull_request' }} | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
|
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
Oops, something went wrong.