Skip to content

Commit

Permalink
feat: add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgomesdev committed Dec 21, 2023
1 parent d9ef9a2 commit 08c4b6a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 34 deletions.
73 changes: 39 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release

on:
push:
branches: ["main"]
branches: ["main", "cicd/add-semantic-release"]

jobs:
build-server:
Expand Down Expand Up @@ -32,20 +32,22 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: 🦀 - Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
# - name: 🦀 - Install Rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ matrix.rust }}
# target: ${{ matrix.target }}
# override: true

# - name: 🌱 - Install dependencies
# run: cargo install cross --git https://github.com/cross-rs/cross

- name: 🌱 - Install dependencies
run: cargo install cross --git https://github.com/cross-rs/cross
# - name: 🔨 - Build
# run: >
# cross build --release --target ${{ matrix.target }} && \
# mv target/**/release/rusty_controller server-${{ matrix.build }}

- name: 🔨 - Build
run: >
cross build --release --target ${{ matrix.target }} && \
mv target/**/release/rusty_controller server-${{ matrix.build }}
- run: echo "hehe" > server-${{ matrix.build }}

- name: 📦 - Copy artifact
uses: actions/upload-artifact@v4
Expand All @@ -65,46 +67,49 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'

- name: 🌱 - Get dependencies
run: flutter pub get
# - name: 🌱 - Get dependencies
# run: flutter pub get

- name: 🔨 - Build APK
run: flutter build apk
# - name: 🔨 - Build APK
# run: flutter build apk

- run: mv build/app/outputs/flutter-apk/app-release.apk ../app.apk
# - run: mv build/app/outputs/flutter-apk/app-release.apk ../app.apk

- run: echo "aaa" > ../app.apk

- name: 📦 - Copy artifact
uses: actions/upload-artifact@v4
with:
name: app.apk
path: app.apk

upload:
release:
needs: [build-server, build-app]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: 📦 - Copy server artifacts
uses: actions/download-artifact@v4
with:
path: .
path: artifacts/
merge-multiple: true

- name: 🧐 - Display structure of downloaded artifacts
run: ls -R
run: ls -R artifacts/

- name: 🌠 - Release
uses: ncipollo/release-action@v1.12.0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
artifacts: "server-*,app.apk"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
removeArtifacts: true
artifactErrorsFailBuild: true
prerelease: true
name: Latest Pre-release
tag: latest
branches: |
[
'main',
'cicd/add-semantic-release'
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"assets": [
{ "path": "artifacts/server-*" },
{ "path": "artifacts/app.apk" }
]
}
]
]
}

0 comments on commit 08c4b6a

Please sign in to comment.