-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update release process for go lib (#203)
Add golib release process
- Loading branch information
Showing
45 changed files
with
654 additions
and
979 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 |
---|---|---|
|
@@ -6,7 +6,4 @@ | |
**/*.d | ||
**/*.dylib | ||
**/*.so | ||
|
||
/docs/ | ||
/examples/ | ||
/modules/ |
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
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
name: Promote Images to DockerHub | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build-images: | ||
|
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
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,73 @@ | ||
name: Build Release Docker Images | ||
on: | ||
create: | ||
tags: '*' | ||
|
||
workflow_dispatch: | ||
jobs: | ||
build-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Automation Code | ||
uses: actions/checkout@v4 | ||
- name: Get Metadata | ||
run: | | ||
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | ||
echo "ISO8601=$(date "+%Y-%m-%dT%H:%M:%S%z")" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Setup Jfrog | ||
uses: jfrog/setup-jfrog-cli@v3 | ||
env: | ||
JF_URL: ${{ secrets.ARTIFACTORY_URL }} | ||
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} | ||
- name: Login to JFrog | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: aerospike.jfrog.io | ||
username: ${{ secrets.ARTIFACTORY_USER }} | ||
password: ${{ secrets.ARTIFACTORY_TOKEN }} | ||
- name: Build and Push | ||
uses: docker/bake-action@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
GIT_COMMIT_SHA: ${{ github.sha }} | ||
GIT_BRANCH: golib-release-proccess | ||
LATEST: false | ||
TAG: ${{ github.ref_name }} | ||
CONTEXT: ${{ github.workspace }} | ||
PROJECT: ${{ github.event.repository.name }} | ||
with: | ||
workdir: ${{ github.workspace }} | ||
files: docker-bake.hcl | ||
targets: default | ||
- name: Promote image with version tag | ||
env: | ||
ARTIFACTORY_CONTAINER_DEV: ${{ vars.ARTIFACTORY_CONTAINER_DEV }} | ||
ARTIFACTORY_CONTAINER_PROD: ${{ vars.ARTIFACTORY_CONTAINER_PROD }} | ||
run: | | ||
jfrog rt docker-promote aerospike-backup-service \ | ||
"$ARTIFACTORY_CONTAINER_DEV" \ | ||
"ecosystem-container-stage-local" \ | ||
--source-tag "$TAG" \ | ||
--target-tag "$TAG" \ | ||
--user "${{ secrets.ARTIFACTORY_USER }}" \ | ||
--password "${{ secrets.ARTIFACTORY_TOKEN }}" \ | ||
--url "${{ secrets.ARTIFACTORY_PROMOTE_URL }}" \ | ||
--copy | ||
- name: Promote image with latest tag | ||
env: | ||
ARTIFACTORY_CONTAINER_DEV: ${{ vars.ARTIFACTORY_CONTAINER_DEV }} | ||
ARTIFACTORY_CONTAINER_PROD: ${{ vars.ARTIFACTORY_CONTAINER_PROD }} | ||
run: | | ||
jfrog rt docker-promote aerospike-backup-service \ | ||
"$ARTIFACTORY_CONTAINER_DEV" \ | ||
"$ARTIFACTORY_CONTAINER_PROD" \ | ||
--source-tag "${{ github.event.inputs.version }}" \ | ||
--target-tag "latest" \ | ||
--user "${{ secrets.ARTIFACTORY_USER }}" \ | ||
--password "${{ secrets.ARTIFACTORY_TOKEN }}" \ | ||
--url "${{ secrets.ARTIFACTORY_PROMOTE_URL }}" \ | ||
--copy |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Nightly Build | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 20 * * *' | ||
jobs: | ||
|
@@ -23,78 +23,39 @@ jobs: | |
fi | ||
outputs: | ||
commit_today: ${{ steps.check-commit.outputs.commit_today }} | ||
|
||
nightly-build: | ||
needs: last-commit | ||
if: ${{ needs.last-commit.outputs.commit_today == 'true' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [ "amd64","arm64" ] | ||
container: [ "rhel8:latest", "rhel9:latest", "ubuntu2204:latest" ] | ||
include: | ||
- container: "rhel8:latest" | ||
cmd: "make rpm" | ||
distro_symbol: "el8" | ||
ext: "rpm" | ||
- container: "rhel9:latest" | ||
cmd: "make rpm" | ||
distro_symbol: "el9" | ||
ext: "rpm" | ||
- container: "ubuntu2204:latest" | ||
cmd: "make deb" | ||
distro_symbol: "debian" | ||
ext: "deb" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Setup Jfrog | ||
uses: jfrog/setup-jfrog-cli@v3 | ||
env: | ||
JF_URL: ${{ secrets.ARTIFACTORY_URL }} | ||
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }} | ||
- name: Login to JFrog | ||
uses: docker/login-action@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
registry: aerospike.jfrog.io | ||
username: ${{ secrets.ARTIFACTORY_USER }} | ||
password: ${{ secrets.ARTIFACTORY_TOKEN }} | ||
- name: Create target directory | ||
run: mkdir -p ${{ github.workspace }}/target | ||
- name: Create lib directory | ||
run: mkdir -p ${{ github.workspace }}/lib | ||
- name: Build artifact | ||
id: build-artifact | ||
go-version: "1.22.5" | ||
- name: Install Dependencies | ||
run: | | ||
docker run \ | ||
-v ${{ github.workspace }}:/aerospike-backup-service/ \ | ||
-w /aerospike-backup-service/ \ | ||
--platform linux/${{ matrix.arch }} \ | ||
aerospike.jfrog.io/ecosystem-container-dev-local/base-${{ matrix.container }} ${{ matrix.cmd }} | ||
- name: Set variable arch variable based on condition | ||
id: set-variables | ||
go install "github.com/goreleaser/nfpm/v2/cmd/nfpm@latest" | ||
- name: Build Packages | ||
env: | ||
PAT: ${{ secrets.PAT }} | ||
run: | | ||
if [ "${{ matrix.arch }}" == "arm64" ]; then | ||
echo "arch=aarch64" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "arch=x86_64" >> "$GITHUB_OUTPUT" | ||
fi | ||
REPO_NAME="$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)" | ||
echo "repo=$REPO_NAME" >> "$GITHUB_OUTPUT" | ||
VERSION="$(cat VERSION)" | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
- name: Deploy Artifact | ||
git config --global url."https://${PAT}:[email protected]/".insteadOf "https://github.com/" | ||
make packages | ||
- name: Find files matching "*.rpm" and "*.deb" | ||
run: | | ||
if [ ${{ matrix.ext }} == "rpm" ]; then | ||
curl \ | ||
-u${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }} \ | ||
-XPUT https://aerospike.jfrog.io/artifactory/ecosystem-${{ matrix.ext }}-dev-local/${{ steps.set-variables.outputs.repo }}/${{ steps.set-variables.outputs.version }}/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}_$(date +%Y%m%d).${{ matrix.ext }} \ | ||
-T ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}.${{ matrix.ext }} | ||
else | ||
ASSET_LIST=$(find . -type f \( -name "*.deb" -or -name "*.rpm" \) | tr '\n' ',') | ||
echo "ASSET_LIST=$ASSET_LIST" >> $GITHUB_ENV | ||
- name: Upload Assets | ||
run: | | ||
IFS=',' read -r -a asset_array <<< "$ASSET_LIST" | ||
for file in "${asset_array[@]}"; do | ||
BASENAME="$(basename ${file%.*})" | ||
EXT="${file##*.}" | ||
curl \ | ||
-u${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }} \ | ||
-XPUT https://aerospike.jfrog.io/artifactory/ecosystem-${{ matrix.ext }}-dev-local/${{ steps.set-variables.outputs.repo }}/${{ steps.set-variables.outputs.version }}/${{ steps.set-variables.outputs.repo }}-${{ steps.set-variables.outputs.version }}-1.${{ matrix.distro_symbol }}.${{ steps.set-variables.outputs.arch }}_$(date +%Y%m%d).${{ matrix.ext }} \ | ||
-T ${{ github.workspace }}/target/${{ steps.set-variables.outputs.repo }}_${{ steps.set-variables.outputs.version }}-1_${{ matrix.arch }}.${{ matrix.ext }} | ||
fi | ||
-XPUT "https://aerospike.jfrog.io/artifactory/ecosystem-$EXT-dev-local/${{ github.event.repository.name }}/$(cat VERSION)/"$BASENAME"_$(date +%Y%m%d).$EXT" \ | ||
-T "$file" | ||
done |
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,87 @@ | ||
name: Create a Release and Push Release assets | ||
on: | ||
create: | ||
tags: '*' | ||
|
||
workflow_dispatch: | ||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
steps: | ||
- name: Check if release exists | ||
id: check-release | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
try { | ||
const response = await github.rest.repos.getReleaseByTag({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag: "${{ github.ref_name }}" | ||
}); | ||
if (response.status === 200) { | ||
console.log(`Release with tag exists.`); | ||
core.setOutput('release-exists', 'true'); | ||
} | ||
} catch (error) { | ||
if (error.status === 404) { | ||
console.log(`Release with tag does not exist.`); | ||
core.setOutput('release-exists', 'false'); | ||
} else { | ||
throw error; | ||
} | ||
} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/create-release@v1 | ||
if: ${{ steps.check-release.outputs.release-exists == 'false'}} | ||
id: create-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: ${{ github.ref_name }} | ||
draft: true | ||
prerelease: true | ||
build-artifacts: | ||
needs: | ||
- create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22.5" | ||
- name: Install Dependencies | ||
run: | | ||
go install "github.com/goreleaser/nfpm/v2/cmd/nfpm@latest" | ||
- name: Build Packages | ||
env: | ||
PAT: ${{ secrets.PAT }} | ||
run: | | ||
git config --global url."https://${PAT}:[email protected]/".insteadOf "https://github.com/" | ||
make packages | ||
- name: Find files matching "*.rpm" "*.deb" and "*sha256" | ||
run: | | ||
ASSET_LIST=$(find . -type f \( -name "*.deb" -or -name "*.rpm" -or -name "*.sha256" \) | tr '\n' ',') | ||
echo "ASSET_LIST=$ASSET_LIST" >> $GITHUB_ENV | ||
- name: Upload Assets | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
upload_url="$(echo "${{ needs.create-release.outputs.upload_url }}" | sed 's/\(assets\).*/\1/')" | ||
IFS=',' read -r -a asset_array <<< "$ASSET_LIST" | ||
for file in "${asset_array[@]}"; do | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: $(file -b --mime-type $file)" \ | ||
"$upload_url?name=$(basename $file)" \ | ||
--data-binary "@$file" | ||
done |
Oops, something went wrong.