mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Add CI/CD step to upload artifacts off-site (#244)
* Download and list artifacts after build * Add commit hash + file extension to artifact name * Initial SSH implementation * Don't build artifacts for PRs * Fetch endpoint from secret * Zip artifacts before uploading to CDN * Use short SHA in archive names
This commit is contained in:
parent
4f6979f236
commit
4354cab7e3
41
.github/workflows/check-builds.yaml
vendored
41
.github/workflows/check-builds.yaml
vendored
@ -13,6 +13,9 @@ jobs:
|
|||||||
ubuntu-build:
|
ubuntu-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Set environment
|
||||||
|
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||||
|
shell: bash
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
@ -42,12 +45,15 @@ jobs:
|
|||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: ubuntu20_04-bin-x64
|
name: 'ubuntu20_04-bin-x64-${{ env.SHORT_SHA }}'
|
||||||
path: bin
|
path: bin
|
||||||
|
|
||||||
windows-build:
|
windows-build:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
steps:
|
steps:
|
||||||
|
- name: Set environment
|
||||||
|
run: $s = $env:GITHUB_SHA.subString(0, 7); echo "SHORT_SHA=$s" >> $env:GITHUB_ENV
|
||||||
|
shell: pwsh
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
@ -92,5 +98,36 @@ jobs:
|
|||||||
- name: Upload build artifact
|
- name: Upload build artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: windows-vs2019-bin-x64
|
name: 'windows-vs2019-bin-x64-${{ env.SHORT_SHA }}'
|
||||||
path: bin
|
path: bin
|
||||||
|
|
||||||
|
copy-artifacts:
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [windows-build, ubuntu-build]
|
||||||
|
env:
|
||||||
|
BOT_SSH_KEY: ${{ secrets.BOT_SSH_KEY }}
|
||||||
|
ENDPOINT: ${{ secrets.ENDPOINT }}
|
||||||
|
steps:
|
||||||
|
- run: mkdir ${{ github.sha }}
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
path: ${{ github.sha }}
|
||||||
|
- name: Prepare artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
sudo apt install zip -y
|
||||||
|
cd ${{ github.sha }}
|
||||||
|
for build in *; do
|
||||||
|
cd $build
|
||||||
|
zip ../$build.zip *
|
||||||
|
cd ..
|
||||||
|
rm -r $build
|
||||||
|
done
|
||||||
|
cd ..
|
||||||
|
- name: Upload artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
umask 077
|
||||||
|
printf %s "$BOT_SSH_KEY" > cdn_key
|
||||||
|
scp -i cdn_key -o StrictHostKeyChecking=no -r ${{ github.sha }} $ENDPOINT
|
||||||
|
Loading…
Reference in New Issue
Block a user