-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: trigger nightly build on push to develop (#434)
"nightly" is renamed to "develop" everywhere (workflow name, docker image...)
- Loading branch information
Showing
1 changed file
with
24 additions
and
49 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 |
---|---|---|
@@ -1,42 +1,25 @@ | ||
name: Nightly build | ||
name: Build develop | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
workflow_dispatch: | ||
schedule: | ||
# Every day at midnight | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
# Check if a build is needed: if the last successful nightly build has been made on the same commit | ||
# as the current one, then a build is not needed | ||
check: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- | ||
uses: octokit/[email protected] | ||
id: check_last_run | ||
with: | ||
route: GET /repos/${{github.repository}}/actions/workflows/nightly.yml/runs?per_page=1&status=completed | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: "echo Last nightly build sha: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha }}" | ||
- run: "echo Current build sha: ${{ github.sha }}" | ||
- run: "echo Should run: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha != github.sha }}" | ||
|
||
outputs: | ||
should_run: ${{ fromJson(steps.check_last_run.outputs.data).workflow_runs[0].head_sha != github.sha }} | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Build core and deploy it to Docker Hub | ||
core: | ||
needs: [check] | ||
if: needs.check.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set version # Write version to package.json and manifest.json | ||
run: | | ||
echo "Setting version to \"nightly (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"nightly (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
echo "Setting version to \"develop (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"develop (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
@@ -56,19 +39,17 @@ jobs: | |
labels: | ||
LEAV Engine | ||
Core | ||
tags: "leavengine/core:nightly" | ||
tags: "leavengine/core:develop" | ||
|
||
# Build preview-generator and deploy it to Docker Hub | ||
preview-generator: | ||
needs: [check] | ||
if: needs.check.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set version # Write version to package.json and manifest.json | ||
run: | | ||
echo "Setting version to \"nightly (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"nightly (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
echo "Setting version to \"develop (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"develop (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
@@ -91,19 +72,17 @@ jobs: | |
labels: | ||
LEAV Engine | ||
Preview Generator | ||
tags: "leavengine/preview-generator:nightly" | ||
tags: "leavengine/preview-generator:develop" | ||
|
||
# Build automate-scan and deploy it to Docker Hub | ||
automate-scan: | ||
needs: [check] | ||
if: needs.check.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set version # Write version to package.json and manifest.json | ||
run: | | ||
echo "Setting version to \"nightly (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"nightly (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
echo "Setting version to \"develop (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"develop (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
@@ -126,19 +105,17 @@ jobs: | |
labels: | ||
LEAV Engine | ||
Automate Scan | ||
tags: "leavengine/automate-scan:nightly" | ||
tags: "leavengine/automate-scan:develop" | ||
|
||
# Build sync-scan and deploy it to Docker Hub | ||
sync-scan: | ||
needs: [check] | ||
if: needs.check.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set version # Write version to package.json and manifest.json | ||
run: | | ||
echo "Setting version to \"nightly (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"nightly (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
echo "Setting version to \"develop (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"develop (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
@@ -161,19 +138,17 @@ jobs: | |
labels: | ||
LEAV Engine | ||
Sync scan | ||
tags: "leavengine/sync-scan:nightly" | ||
tags: "leavengine/sync-scan:develop" | ||
|
||
# Build logs-collector and deploy it to Docker Hub | ||
logs-collector: | ||
needs: [check] | ||
if: needs.check.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set version # Write version to package.json and manifest.json | ||
run: | | ||
echo "Setting version to \"nightly (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"nightly (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
echo "Setting version to \"develop (${{ github.sha }})\"" | ||
find \( -name "package.json" -o -name "manifest.json" \) -not -path "*/node_modules/*" -not -path "*/__tests__/*" -type f -exec sh -c 'jq ".version = \"develop (${{ github.sha }})\"" {} > tmpfile && mv tmpfile {}' \; | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
@@ -196,4 +171,4 @@ jobs: | |
labels: | ||
LEAV Engine | ||
Logs Collector | ||
tags: "leavengine/logs-collector:nightly" | ||
tags: "leavengine/logs-collector:develop" |