Skip to content

Commit

Permalink
CI build and release updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tzununbekov committed Feb 20, 2024
1 parent b1b6e97 commit 6cf4918
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 17 deletions.
60 changes: 45 additions & 15 deletions .github/workflows/build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,42 @@ env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
setup-env:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'

- name: Prepare environment
run: |
BUILD_TAG=
echo "BUILD_COMMIT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
echo "BUILD_NUMBER=${{ github.repository}}-${{ github.workflow }}-${{ github.run_id }}-ghactions" >> $GITHUB_ENV
echo "BUILD_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_BRANCH_SAFE=${{ github.ref }}" >> $GITHUB_ENV
echo "BUILD_TAG=${{ github.ref }}" >> $GITHUB_ENV
echo "RELEASE_BUILD
- name: Create bucket
run: |
go run mage.go -v MakeBucket
- name: Generate Env
run: go run mage.go -v GenerateEnvFile

- uses: actions/upload-artifact@v4
with:
name: env.sh
path: build/env.sh

build-packages:
runs-on: ubuntu-latest
needs: [setup-env]

strategy:
max-parallel: 4
Expand All @@ -36,11 +70,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Generate Env
run: go run mage.go -v GenerateEnvFile
- uses: actions/download-artifact@v4
with:
name: env.sh

- name: Setup FPM
run: |
Expand All @@ -52,24 +87,22 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source build/env.sh
# Following line ensures that s3 bucket name won't overlap with the old CI's target
# Should be removed when the old CI is disabled
export BUILD_NUMBER=$BUILD_NUMBER"-ghactions"
source env.sh
go run mage.go -v ${{ matrix.platform }}
build-swagger:
runs-on: ubuntu-latest
needs: [build-packages]
needs: [setup-env, build-packages]

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Generate Env
run: go run mage.go -v GenerateEnvFile
- uses: actions/download-artifact@v4
with:
name: env.sh
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -83,8 +116,5 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
source build/env.sh
# Following line ensures that s3 bucket name won't overlap with the old CI's target
# Should be removed when the old CI is disabled
export BUILD_NUMBER=$BUILD_NUMBER"-ghactions"
source env.sh
go run mage.go -v PackageDockerSwaggerRedoc
90 changes: 90 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Release
on:
workflow_call:
# push:
# tags:

jobs:
release-snapshot:
runs-on: ubuntu-latest

strategy:
max-parallel: 3
matrix:
platform:
- ReleaseGithubSnapshot
# master only
# - ReleaseGithubNightly
- ReleaseDockerSnapshot
- ReleaseDebianPPASnapshot

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- uses: actions/download-artifact@v4
with:
name: env.sh
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Release snapshot
run: |
source env.sh
go run mage.go -v ${{ matrix.platform }}
# master only
# - name: Release Go report
# run: bin/release_goreport

release-tag:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
matrix:
platform:
- ReleaseGithubTag
- ReleaseDockerTag
- ReleaseDebianPPAPreRelease
- ReleaseAndroidSDK
- ReleaseAndroidProviderSDK

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- uses: actions/download-artifact@v4
with:
name: env.sh
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Release tag
run: |
source build/env.sh
go run mage.go -v ${{ matrix.platform }}
post-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Generate Env
run: go run mage.go -v GenerateEnvFile
- name: Remove bucket
run: go run mage.go -v RemoveBucket
# master only
# - name: Notify UptimeRobot
# run: |
# if [ "$NIGHTLY_BUILD" = "1" -o "$NIGHTLY_BUILD" = "T" -o "$NIGHTLY_BUILD" = "true" -o "$NIGHTLY_BUILD" = "True" -o "$NIGHTLY_BUILD" = "TRUE" ]; then
# curl -so /dev/null -I "$NIGHTLY_UPTIMEROBOT"
# fi
- name: PR Avado
run: go run mage.go -v CreateAvadoPR

4 changes: 2 additions & 2 deletions .github/workflows/tests-and-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.x'

Expand All @@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.x'

Expand Down

0 comments on commit 6cf4918

Please sign in to comment.