mirror of
https://github.com/asherkin/accelerator.git
synced 2025-12-06 18:08:30 +00:00
Add release workflow (#40)
* Add release workflow * Restrict to direct push * Update dependent CI * Correct main CI * Optimize workflow dispatch * Restrict to 'workflow_call' * Don't rely on 'workflow_call' * Actually use UPLOAD_PASSWORD * add the -git tag * use short sha * fix platform naming mistake * Add branch param to upload url * Setup PR workflow * modify the trigger * Add branch name debug + renable PR workflow * Try %22 * No quotes!
This commit is contained in:
parent
38f7e5d6f2
commit
0efbfbeccb
64
.github/workflows/ci.yml
vendored
64
.github/workflows/ci.yml
vendored
@ -1,54 +1,46 @@
|
||||
name: CI
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- overhaul
|
||||
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- overhaul
|
||||
workflow_call:
|
||||
inputs:
|
||||
release:
|
||||
type: boolean
|
||||
required: true
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
uses: ./.github/workflows/cache.yml
|
||||
|
||||
build-options:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
exclude: ${{ steps.set.outputs.exclude }}
|
||||
steps:
|
||||
- id: set
|
||||
run: |
|
||||
echo "exclude=[${{ inputs.release && '{"runners": { "upload": false } }' || '' }}]" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
name: Build
|
||||
needs: cache
|
||||
needs: [ cache, build-options ]
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ 'ubuntu-22.04', 'ubuntu-latest', 'windows-latest' ]
|
||||
include:
|
||||
# we need to ship ubuntu 22.04 because of glibc reasons
|
||||
- os: ubuntu-22.04
|
||||
#cc: clang-8
|
||||
#cxx: clang++-8
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
upload: true
|
||||
upload-artifact-name: accelerator_linux
|
||||
- os: ubuntu-latest
|
||||
cc: clang
|
||||
cxx: clang++
|
||||
upload: false
|
||||
upload-artifact-name: none
|
||||
- os: windows-latest
|
||||
cc: msvc
|
||||
cxx: msvc
|
||||
upload: true
|
||||
upload-artifact-name: accelerator_windows
|
||||
runners: [
|
||||
{ os: ubuntu-22.04, cc: clang, cxx: clang++, upload: true, upload-artifact-name: accelerator_linux },
|
||||
{ os: ubuntu-latest, cc: clang, cxx: clang++, upload: false },
|
||||
{ os: windows-latest, cc: msvc, cxx: msvc, upload: true, upload-artifact-name: accelerator_windows }
|
||||
]
|
||||
exclude: ${{ fromJson(needs.build-options.outputs.exclude) }}
|
||||
|
||||
uses: ./.github/workflows/build-extension.yml
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
cc: ${{ matrix.cc }}
|
||||
cxx: ${{ matrix.cxx }}
|
||||
upload: ${{ matrix.upload }}
|
||||
upload-artifact-name: ${{ matrix.upload-artifact-name }}
|
||||
os: ${{ matrix.runners.os }}
|
||||
cc: ${{ matrix.runners.cc }}
|
||||
cxx: ${{ matrix.runners.cxx }}
|
||||
upload: ${{ matrix.runners.upload }}
|
||||
upload-artifact-name: ${{ matrix.runners.upload-artifact-name }}
|
||||
cache-key: ${{ needs.cache.outputs.key }}
|
||||
cache-dir: ${{ needs.cache.outputs.dir }}
|
||||
cache-dir: ${{ needs.cache.outputs.dir }}
|
||||
12
.github/workflows/pull_request.yml
vendored
Normal file
12
.github/workflows/pull_request.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
name: Pull Request
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
main-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
release: false
|
||||
76
.github/workflows/release.yml
vendored
Normal file
76
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ master, release_ci ]
|
||||
|
||||
jobs:
|
||||
main-ci:
|
||||
uses: ./.github/workflows/ci.yml
|
||||
with:
|
||||
release: true
|
||||
|
||||
release:
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ main-ci ]
|
||||
|
||||
env:
|
||||
PROJECT: 'accelerator'
|
||||
steps:
|
||||
- run: sudo apt-get install -y tree
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
name: Repository checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
path: repository
|
||||
|
||||
- name: Download Linux release
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: accelerator_linux
|
||||
path: linux
|
||||
|
||||
- name: Download Windows release
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: accelerator_windows
|
||||
path: windows
|
||||
|
||||
- name: Zip release again
|
||||
run: |
|
||||
cd repository
|
||||
read -r PRODUCT_VERSION < ./product.version
|
||||
REV_COUNT=$(git rev-list --count HEAD)
|
||||
REV_SHA=$(git rev-parse --short HEAD)
|
||||
cd ..
|
||||
WINDOWS_ZIP="${{ env.PROJECT }}-$PRODUCT_VERSION-git$REV_COUNT-$REV_SHA-windows.zip"
|
||||
LINUX_ZIP="${{ env.PROJECT }}-$PRODUCT_VERSION-git$REV_COUNT-$REV_SHA-linux.zip"
|
||||
zip -r ${WINDOWS_ZIP} windows
|
||||
zip -r ${LINUX_ZIP} linux
|
||||
|
||||
echo "WINDOWS_ZIP=${WINDOWS_ZIP}" >> $GITHUB_ENV
|
||||
echo "LINUX_ZIP=${LINUX_ZIP}" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload release
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Begin upload for branch (${{ github.ref_name }})"
|
||||
AUTHORIZATION="$(echo -n 'builds:${{ secrets.UPLOAD_PASSWORD }}' | base64)"
|
||||
echo "::add-mask::${AUTHORIZATION}"
|
||||
|
||||
echo "Uploading ${{ env.WINDOWS_ZIP }}"
|
||||
HTTP_CODE=$(curl -XPOST -H "Authorization: Basic ${AUTHORIZATION}" -H "Content-Type: application/zip" --output /dev/null --silent --write-out "%{http_code}" --data-binary "@${{ env.WINDOWS_ZIP }}" "https://builds.limetech.io/upload.php?project=${{ env.PROJECT }}&branch=${{ github.ref_name }}&filename=${{ env.WINDOWS_ZIP }}")
|
||||
if test ${HTTP_CODE} -ne 200; then
|
||||
echo "Upload failed with HTTP Code: ${HTTP_CODE}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploading ${{ env.LINUX_ZIP }}"
|
||||
HTTP_CODE=$(curl -XPOST -H "Authorization: Basic ${AUTHORIZATION}" -H "Content-Type: application/zip" --output /dev/null --silent --write-out "%{http_code}" --data-binary "@${{ env.LINUX_ZIP }}" "https://builds.limetech.io/upload.php?project=${{ env.PROJECT }}&branch=${{ github.ref_name }}&filename=${{ env.LINUX_ZIP }}")
|
||||
if test ${HTTP_CODE} -ne 200; then
|
||||
echo "Upload failed with HTTP Code: ${HTTP_CODE}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Upload successful!"
|
||||
Loading…
Reference in New Issue
Block a user