-
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.
ci: refactor and run build also on main branch (#177)
* ci: refactor * ci: add step to determine that none of the dependant job failed * ci: change if condition syntax * ci: remove unexisting job reference * ci: fix typo * ci: try to remove name of action * ci: add outputs for next version precomputation * ci: alway run success job * ci: cleanup
- Loading branch information
1 parent
13cc71b
commit 5165d62
Showing
2 changed files
with
123 additions
and
114 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 |
---|---|---|
|
@@ -2,12 +2,10 @@ name: Revue CI | |
|
||
on: | ||
push: | ||
branches: [ '**', '!main' ] | ||
workflow_dispatch: | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
|
@@ -31,7 +29,6 @@ jobs: | |
run: ./gradlew build --info | ||
- name: Test | ||
run: ./gradlew auth:test user:test alarm:test device:test log:test notification:test location:test --info | ||
|
||
style: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -45,3 +42,126 @@ jobs: | |
run: ./gradlew format --info | ||
- name: Check lint | ||
run: ./gradlew lint --info | ||
compute-next-version: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
outputs: | ||
will-release: ${{ steps.compute-next-version.outputs.will-release }} | ||
next-version: ${{ steps.compute-next-version.outputs.next-version }} | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/[email protected] | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '21' | ||
cache: 'npm' | ||
- name: Pre-compute the next version | ||
id: compute-next-version | ||
uses: nicolasfara/[email protected] | ||
with: | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
- name: Use the next version | ||
run: | | ||
echo "Will release: ${{ steps.compute-next-version.outputs.will-release }}" | ||
echo "The next version is ${{ steps.compute-next-version.outputs.next-version }}" | ||
release: | ||
needs: | ||
- build | ||
- style | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
# Only one release job at a time per branch, strictly sequential. | ||
group: release-${{ github.event.number || github.ref }} | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
id-token: write | ||
if: >- | ||
!github.event.repository.fork | ||
&& ( | ||
github.event_name != 'pull_request' | ||
|| github.event.pull_request.head.repo.full_name == github.repository | ||
) | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
- name: Install dependencies | ||
run: npm clean-install | ||
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | ||
run: npm audit signatures | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: npx semantic-release | ||
docker: | ||
name: Push ${{ matrix.image }} image to docker hub | ||
strategy: | ||
matrix: | ||
image: | ||
- alarm | ||
- auth | ||
- device | ||
- frontend | ||
- location | ||
- log | ||
- monitoring | ||
- notification | ||
- recognition | ||
- user | ||
needs: | ||
- compute-next-version | ||
- release | ||
runs-on: ubuntu-latest | ||
if: >- | ||
!github.event.repository.fork | ||
&& ( | ||
github.event_name != 'pull_request' | ||
|| github.event.pull_request.head.repo.full_name == github.repository | ||
) && fromJSON(needs.compute-next-version.outputs.will-release) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
- name: Login to Docker Hub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
context: ./${{ matrix.image }} | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
letsdothisshared/revue-${{ matrix.image }}:${{ needs.compute-next-version.outputs.next-version }} | ||
letsdothisshared/revue-${{ matrix.image }}:latest | ||
success: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- style | ||
- release | ||
- docker | ||
- compute-next-version | ||
# Always run this job, even if the previous jobs failed | ||
if: >- | ||
always() && (failure() || !contains(join(needs.*.result, ','), 'cancelled')) | ||
steps: | ||
- name: None of the dependant jobs should fail | ||
run: ${{ !contains(join(needs.*.result, ','), 'failure') }} |
This file was deleted.
Oops, something went wrong.