mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
ci: only create nightly release if build passes (#590)
Changes the nightly build workflow to delete/create a new release *only* if the entire build process passes. This avoids a potential case of a nightly build failing but having overwritten the old one, which has happened before. After this change lands, similar changes will probably be made to the deployment script for releases.
This commit is contained in:
parent
865d0dac78
commit
9071e37283
2
.github/workflows/deployment.yml
vendored
2
.github/workflows/deployment.yml
vendored
@ -450,7 +450,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Execute choco packaging script
|
- name: Execute choco packaging script
|
||||||
run: |
|
run: |
|
||||||
python "./deployment/windows/choco/choco_packager.py" "./artifacts/bottom_i686-pc-windows-msvc.zip" "./artifacts/bottom_x86_64-pc-windows-msvc.zip" ${{ env.RELEASE_VERSION }} "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolateyinstall.ps1.template" "bottom.nuspec" "tools/chocolateyinstall.ps1" "tools/"
|
python "./deployment/windows/choco/choco_packager.py" "./artifacts/bottom_i686-pc-windows-msvc.zip" "./artifacts/bottom_x86_64-pc-windows-msvc.zip" ${{ env.RELEASE_VERSION }} "./deployment/windows/choco/bottom.nuspec.template" "./deployment/windows/choco/chocolatey_install.ps1.template" "bottom.nuspec" "tools/chocolatey_install.ps1" "tools/"
|
||||||
zip -r choco.zip "bottom.nuspec" "tools"
|
zip -r choco.zip "bottom.nuspec" "tools"
|
||||||
|
|
||||||
- name: Upload choco.zip to release
|
- name: Upload choco.zip to release
|
||||||
|
196
.github/workflows/nightly.yml
vendored
196
.github/workflows/nightly.yml
vendored
@ -14,13 +14,10 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-github-release:
|
initialize-job:
|
||||||
name: create-github-release
|
name: initialize-job
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Create artifacts directory
|
|
||||||
run: mkdir artifacts
|
|
||||||
|
|
||||||
- name: Check if mock
|
- name: Check if mock
|
||||||
run: |
|
run: |
|
||||||
echo "${{ github.event.inputs.isMock }}";
|
echo "${{ github.event.inputs.isMock }}";
|
||||||
@ -32,45 +29,19 @@ jobs:
|
|||||||
echo "This is NOT a mock run. Watch for the generated files!"
|
echo "This is NOT a mock run. Watch for the generated files!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Delete tag and release
|
|
||||||
uses: dev-drprasad/delete-tag-and-release@v0.1.3
|
|
||||||
if: github.event.inputs.isMock != 'mock'
|
|
||||||
with:
|
|
||||||
delete_release: true
|
|
||||||
tag_name: nightly
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release
|
|
||||||
run: sleep 10
|
|
||||||
|
|
||||||
- name: Create nightly GitHub release
|
|
||||||
id: release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
if: github.event.inputs.isMock != 'mock'
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
draft: false
|
|
||||||
tag_name: nightly
|
|
||||||
release_name: nightly
|
|
||||||
prerelease: true
|
|
||||||
|
|
||||||
- name: Save release upload URL to artifact
|
|
||||||
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url
|
|
||||||
|
|
||||||
- name: Save version number to artifact
|
- name: Save version number to artifact
|
||||||
run: echo "nightly" > artifacts/release-version
|
run: echo "nightly" > release-version
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload release-version as artifact
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
retention-days: 1
|
||||||
path: artifacts
|
name: release-version
|
||||||
|
path: release-version
|
||||||
|
|
||||||
build-release:
|
build-release:
|
||||||
name: build-release
|
name: build-release
|
||||||
needs: [create-github-release]
|
needs: [initialize-job]
|
||||||
runs-on: ${{ matrix.triple.os }}
|
runs-on: ${{ matrix.triple.os }}
|
||||||
container: ${{ matrix.triple.container }}
|
container: ${{ matrix.triple.container }}
|
||||||
env:
|
env:
|
||||||
@ -164,25 +135,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Get release download URL
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: artifacts
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: Set release upload URL and release version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
release_upload_url="$(cat ./artifacts/release-upload-url)"
|
|
||||||
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
|
|
||||||
release_version="$(cat ./artifacts/release-version)"
|
|
||||||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Validate release environment variables
|
|
||||||
run: |
|
|
||||||
echo "Release upload url: ${{ env.RELEASE_UPLOAD_URL }}"
|
|
||||||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@ -232,38 +184,29 @@ jobs:
|
|||||||
tar -czvf bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz btm completion
|
tar -czvf bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz btm completion
|
||||||
echo "ASSET=bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz" >> $GITHUB_ENV
|
echo "ASSET=bottom_${{ matrix.triple.target }}${{ matrix.triple.suffix }}.tar.gz" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload main release
|
- name: Create release directory for artifact, move file
|
||||||
if: github.event.inputs.isMock != 'mock'
|
shell: bash
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
run: |
|
||||||
id: upload
|
mkdir release
|
||||||
env:
|
mv ${{ env.ASSET }} release
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
|
|
||||||
asset_path: ${{ env.ASSET }}
|
|
||||||
asset_name: ${{ env.ASSET }}
|
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
- name: Compress completion files (Linux x86-64 GNU)
|
- name: Compress completion files (Linux x86-64 GNU)
|
||||||
if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == ''
|
if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == ''
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tar -C ./completion -czvf completion.tar.gz .
|
tar -C ./completion -czvf completion.tar.gz .
|
||||||
|
mv completion.tar.gz release
|
||||||
|
|
||||||
- name: Release completion files (Linux x86-64 GNU)
|
- name: Save release files as artifacts
|
||||||
if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' && github.event.inputs.isMock != 'mock'
|
uses: actions/upload-artifact@v2
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
|
retention-days: 1
|
||||||
asset_path: completion.tar.gz
|
name: release
|
||||||
asset_name: completion.tar.gz
|
path: release
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
build-msi:
|
build-msi:
|
||||||
name: build-msi
|
name: build-msi
|
||||||
needs: [create-github-release]
|
needs: [initialize-job]
|
||||||
runs-on: "windows-2019"
|
runs-on: "windows-2019"
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
@ -276,20 +219,17 @@ jobs:
|
|||||||
- name: Get release download URL
|
- name: Get release download URL
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: release-version
|
||||||
path: artifacts
|
path: release-version
|
||||||
|
|
||||||
- name: Set release upload URL and release version
|
- name: Set release version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
release_upload_url="$(cat ./artifacts/release-upload-url)"
|
release_version="$(cat ./release-version/release-version)"
|
||||||
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
|
|
||||||
release_version="$(cat ./artifacts/release-version)"
|
|
||||||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Validate release environment variables
|
- name: Validate release environment variables
|
||||||
run: |
|
run: |
|
||||||
echo "Release upload url: ${{ env.RELEASE_UPLOAD_URL }}"
|
|
||||||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||||
|
|
||||||
- name: Install Net-Framework-Core
|
- name: Install Net-Framework-Core
|
||||||
@ -320,20 +260,22 @@ jobs:
|
|||||||
cargo wix init
|
cargo wix init
|
||||||
cargo wix
|
cargo wix
|
||||||
|
|
||||||
- name: Upload msi file
|
- name: Create release directory for artifact, move file
|
||||||
if: github.event.inputs.isMock != 'mock'
|
shell: bash
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
run: |
|
||||||
env:
|
mkdir release
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
mv bottom_x86_64_installer.msi release
|
||||||
|
|
||||||
|
- name: Save msi file as artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
|
retention-days: 1
|
||||||
asset_path: bottom_x86_64_installer.msi
|
name: release
|
||||||
asset_name: bottom_x86_64_installer.msi
|
path: release
|
||||||
asset_content_type: application/octet-stream
|
|
||||||
|
|
||||||
build-deb:
|
build-deb:
|
||||||
name: build-deb
|
name: build-deb
|
||||||
needs: [create-github-release]
|
needs: [initialize-job]
|
||||||
runs-on: "ubuntu-18.04"
|
runs-on: "ubuntu-18.04"
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
@ -346,20 +288,17 @@ jobs:
|
|||||||
- name: Get release download URL
|
- name: Get release download URL
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: release-version
|
||||||
path: artifacts
|
path: release-version
|
||||||
|
|
||||||
- name: Set release upload URL and release version
|
- name: Set release upload URL and release version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
release_upload_url="$(cat ./artifacts/release-upload-url)"
|
release_version="$(cat ./release-version/release-version)"
|
||||||
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
|
|
||||||
release_version="$(cat ./artifacts/release-version)"
|
|
||||||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Validate release environment variables
|
- name: Validate release environment variables
|
||||||
run: |
|
run: |
|
||||||
echo "Release upload url: ${{ env.RELEASE_UPLOAD_URL }}"
|
|
||||||
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||||
|
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
@ -380,13 +319,56 @@ jobs:
|
|||||||
cargo deb
|
cargo deb
|
||||||
cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb
|
cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb
|
||||||
|
|
||||||
- name: Upload Debian file if not mock
|
- name: Create release directory for artifact, move file
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir release
|
||||||
|
mv bottom_${{ env.RELEASE_VERSION }}_amd64.deb release
|
||||||
|
|
||||||
|
- name: Save Debian file as artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
retention-days: 1
|
||||||
|
name: release
|
||||||
|
path: release
|
||||||
|
|
||||||
|
upload-release:
|
||||||
|
name: upload-release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build-release, build-deb, build-msi]
|
||||||
|
steps:
|
||||||
|
- name: Get release artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: release
|
||||||
|
path: release
|
||||||
|
|
||||||
|
- name: Print out all release files
|
||||||
|
run: |
|
||||||
|
echo "Generated $(ls ./release | wc -l) files:"
|
||||||
|
ls ./release
|
||||||
|
|
||||||
|
- name: Delete tag and release
|
||||||
|
uses: dev-drprasad/delete-tag-and-release@v0.1.3
|
||||||
if: github.event.inputs.isMock != 'mock'
|
if: github.event.inputs.isMock != 'mock'
|
||||||
uses: actions/upload-release-asset@v1.0.1
|
with:
|
||||||
|
delete_release: true
|
||||||
|
tag_name: nightly
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release
|
||||||
|
run: sleep 10
|
||||||
|
if: github.event.inputs.isMock != 'mock'
|
||||||
|
|
||||||
|
- name: Upload all saved release files if not mock
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: github.event.inputs.isMock != 'mock'
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
asset_path: bottom_${{ env.RELEASE_VERSION }}_amd64.deb
|
prerelease: true
|
||||||
asset_name: bottom_${{ env.RELEASE_VERSION }}_amd64.deb
|
tag_name: "nightly"
|
||||||
asset_content_type: application/octet-stream
|
draft: false
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
files: |
|
||||||
|
./release/*
|
||||||
|
@ -49,7 +49,7 @@ with open(deployment_file_path_32, "rb") as deployment_file_32, open(
|
|||||||
with open(ps1_template, "r") as template_file:
|
with open(ps1_template, "r") as template_file:
|
||||||
template = Template(template_file.read())
|
template = Template(template_file.read())
|
||||||
substitute = template.safe_substitute(version=version, hash_32=hash_32, hash_64=hash_64)
|
substitute = template.safe_substitute(version=version, hash_32=hash_32, hash_64=hash_64)
|
||||||
print("\n================== Generated chocolateyinstall file ==================\n")
|
print("\n================== Generated chocolatey-install file ==================\n")
|
||||||
print(substitute)
|
print(substitute)
|
||||||
print("\n============================================================\n")
|
print("\n============================================================\n")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user