cd: add github action to trigger Circle CI pipeline

This commit is contained in:
Kingkor Roy Tirtho 2023-09-15 13:14:04 +06:00
parent 5dd958076b
commit 95b197a304
2 changed files with 105 additions and 9 deletions

View File

@ -8,9 +8,31 @@ jobs:
machine:
image: ubuntu-2204:current
resource_class: arm.medium
parameters:
version:
type: string
default: 3.1.1
channel:
type: enum
enum:
- release
- nightly
default: release
github_run_number:
type: string
default: "0"
dry_run:
type: boolean
default: true
steps:
- checkout
- gh/setup
- run:
name: Get current date
command: |
echo "export CURRENT_DATE=$(date +%Y-%m-%d)" >> $BASH_ENV
- run:
name: Install dependencies
command: |
@ -38,10 +60,23 @@ jobs:
paths:
- .
- run:
name: Replace texts in files
command: |
echo "build_arch: aarch64" >> linux/packaging/rpm/make_config.yaml
- when:
condition:
equal: [<< parameters.channel >>, nightly]
steps:
- run:
name: Replace pubspec version and BUILD_VERSION Env (nightly)
command: |
curl -sS https://webi.sh/yq | sh
yq -i '.version |= sub("\+\d+", "+<< parameters.channel >>.")' pubspec.yaml
yq -i '.version += strenv(GITHUB_RUN_NUMBER)' pubspec.yaml
echo 'export BUILD_VERSION="<< parameters.version >>+<< parameters.channel >>.<< parameters.github_run_number >>"' >> $BASH_ENV
- when:
condition:
equal: [<< parameters.channel >>, release]
steps:
- run: echo 'export BUILD_VERSION="<< parameters.version >>"' >> $BASH_ENV
- run:
name: Generate .env file
@ -50,6 +85,12 @@ jobs:
echo "SUPABASE_URL=${SUPABASE_URL}" >> .env
echo "SUPABASE_API_KEY=${SUPABASE_API_KEY}" >> .env
- run:
name: Replace Version in files
command: |
sed -i 's|%{{APPDATA_RELEASE}}%|<release version="${BUILD_VERSION}" date="${CURRENT_DATE}" />|' linux/com.github.KRTirtho.Spotube.appdata.xml
echo "build_arch: aarch64" >> linux/packaging/rpm/make_config.yaml
- run:
name: Build secrets
command: |
@ -68,7 +109,18 @@ jobs:
flutter_distributor package --platform=linux --targets=deb
flutter_distributor package --platform=linux --targets=appimage
flutter_distributor package --platform=linux --targets=rpm
make tar VERSION=nightly ARCH=arm64 PKG_ARCH=aarch64
- when:
condition:
equal: [<< parameters.channel >>, nightly]
steps:
- run: make tar VERSION=nightly ARCH=arm64 PKG_ARCH=aarch64
- when:
condition:
equal: [<< parameters.channel >>, release]
steps:
- run: make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64
- run:
name: Move artifacts
@ -83,12 +135,43 @@ jobs:
- store_artifacts:
path: Spotube-linux-aarch64.zip
- run:
name: Upload to release
command: gh release upload nightly bundle/* --clobber
- when:
condition:
and:
- equal: [<< parameters.dry_run >>, false]
- equal: [<< parameters.channel >>, release]
steps:
- run:
name: Upload to release (release)
command: gh release upload v<< parameters.version >> bundle/* --clobber
- when:
condition:
and:
- equal: [<< parameters.dry_run >>, false]
- equal: [<< parameters.channel >>, nightly]
steps:
- run:
name: Upload to release (nightly)
command: gh release upload nightly bundle/* --clobber
parameters:
GHA_Actor:
type: string
default: ""
GHA_Action:
type: string
default: ""
GHA_Event:
type: string
default: ""
GHA_Meta:
type: string
default: ""
workflows:
build_flutter_for_arm_workflow:
when: << pipeline.parameters.GHA_Action >>
jobs:
- flutter_linux_arm:
context:

View File

@ -26,7 +26,7 @@ on:
default: true
env:
FLUTTER_VERSION: '3.10.0'
FLUTTER_VERSION: '3.13.2'
jobs:
windows:
@ -322,6 +322,19 @@ jobs:
name: Spotube-Release-Binaries
path: |
build/Spotube-macos-universal.dmg
linux_arm:
runs-on: ubuntu-latest
steps:
- uses: CircleCI-Public/trigger-circleci-pipeline-action@v1.1.0
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
with:
GHA_Action: true
version: ${{ inputs.version }}
channel: ${{ inputs.channel }}
github_run_number: ${{ github.run_number }}
dry_run: ${{ inputs.dry_run }}
upload:
runs-on: ubuntu-latest