-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nightly build update URL in README.md file (#257)
Co-authored-by: Hien To <[email protected]>
- Loading branch information
Showing
3 changed files
with
145 additions
and
3 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 |
---|---|---|
|
@@ -7,10 +7,10 @@ on: | |
branches: | ||
- main | ||
tags: ["v[0-9]+.[0-9]+.[0-9]+"] | ||
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cc', '**/*.cxx', '!docs/**', '!.gitignore'] | ||
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cc', '**/*.cxx', '!docs/**', '!.gitignore', "!README.md"] | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cc', '**/*.cxx', '!docs/**', '!.gitignore'] | ||
paths: ['.github/scripts/**','.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cc', '**/*.cxx', '!docs/**', '!.gitignore', "!README.md"] | ||
workflow_dispatch: | ||
|
||
env: | ||
|
@@ -482,21 +482,53 @@ jobs: | |
needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
token: ${{ secrets.PAT_SERVICE_ACCOUNT }} | ||
- name: Notify Discord | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: "Nightly build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
- name: Update README.md with artifact URL | ||
run: | | ||
sed -i "s|<a href='https://github.com/janhq/nitro/actions/runs/.*'>|<a href='https://github.com/janhq/nitro/actions/runs/${GITHUB_RUN_ID}'>|" README.md | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Service Account" | ||
git add README.md | ||
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main | ||
env: | ||
GITHUB_RUN_ID: ${{ github.run_id }} | ||
|
||
noti-discord-manual: | ||
if: always() && github.event_name == 'workflow_dispatch' && (needs.create-draft-release.result == 'success' || needs.create-draft-release.result == 'skipped') && needs.ubuntu-amd64-build.result == 'success' && needs.ubuntu-amd64-cuda-build.result == 'success' && needs.macOS-M-build.result == 'success' && needs.macOS-Intel-build.result == 'success' && needs.windows-amd64-build.result == 'success' && needs.windows-amd64-cuda-build.result == 'success' | ||
needs: [create-draft-release, ubuntu-amd64-build, ubuntu-amd64-cuda-build, macOS-M-build, macOS-Intel-build, windows-amd64-build, windows-amd64-cuda-build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
token: ${{ secrets.PAT_SERVICE_ACCOUNT }} | ||
- name: Notify Discord | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: "Manual build artifact: https://github.com/janhq/nitro/actions/runs/{{ GITHUB_RUN_ID }}" | ||
env: | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
# Update README.md with artifact URL if manual build from main branch | ||
- name: Update README.md with artifact URL | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
sed -i "s|<a href='https://github.com/janhq/nitro/actions/runs/.*'>|<a href='https://github.com/janhq/nitro/actions/runs/${GITHUB_RUN_ID}'>|" README.md | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Service Account" | ||
git add README.md | ||
git commit -m "${GITHUB_REPOSITORY}: Update README.md with nightly build artifact URL" | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main | ||
env: | ||
GITHUB_RUN_ID: ${{ github.run_id }} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Update Download URLs | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" | ||
token: ${{ secrets.PAT_SERVICE_ACCOUNT }} | ||
ref: main | ||
|
||
- name: Get Latest Release | ||
uses: pozetroninc/[email protected] | ||
id: get-latest-release | ||
with: | ||
repository: ${{ github.repository }} | ||
|
||
- name: Update Download URLs in README.md | ||
run: | | ||
echo "Latest Release: ${{ steps.get-latest-release.outputs.release }}" | ||
tag=$(/bin/echo -n "${{ steps.get-latest-release.outputs.release }}") | ||
echo "Tag: $tag" | ||
# Remove the v prefix | ||
release=${tag:1} | ||
echo "Release: $release" | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-linux-amd64-cuda.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-linux-amd64-cuda.tar.gz'>|" README.md | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-linux-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-linux-amd64.tar.gz'>|" README.md | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-mac-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-mac-amd64.tar.gz'>|" README.md | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-mac-arm64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-mac-arm64.tar.gz'>|" README.md | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-win-amd64-cuda.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-win-amd64-cuda.tar.gz'>|" README.md | ||
sed -i "s|<a href='https://github.com/janhq/nitro/releases/download/v.*-win-amd64.tar.gz'>|<a href='https://github.com/janhq/nitro/releases/download/v${release}/nitro-${release}-win-amd64.tar.gz'>|" README.md | ||
- name: Commit and Push changes | ||
if: github.event_name == 'release' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Service Account" | ||
git add README.md | ||
git commit -m "Update README.md with Stable Download URLs" | ||
git -c http.extraheader="AUTHORIZATION: bearer ${{ secrets.PAT_SERVICE_ACCOUNT }}" push origin HEAD:main |
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