mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 04:00:24 +08:00
85 lines
4.0 KiB
YAML
85 lines
4.0 KiB
YAML
name: Split Bundle
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
cli-release:
|
|
description: 'CodeQL CLI Release (e.g., "v2.2.5")'
|
|
required: true
|
|
bundle-tag:
|
|
description: 'Tag of the bundle release (e.g., "codeql-bundle-20200826")'
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CLI_RELEASE: "${{ github.event.inputs.cli-release }}"
|
|
RELEASE_TAG: "${{ github.event.inputs.bundle-tag }}"
|
|
|
|
strategy:
|
|
matrix:
|
|
platform: ["linux64", "osx64", "win64"]
|
|
language: ["cpp", "csharp", "go", "java", "javascript", "python"]
|
|
|
|
steps:
|
|
- name: Resolve Upload URL for the release
|
|
id: save_url
|
|
run: |
|
|
UPLOAD_URL=$(curl -sS \
|
|
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}" \
|
|
-H "Accept: application/json" \
|
|
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq .upload_url | sed s/\"//g)
|
|
echo ${UPLOAD_URL}
|
|
echo "::set-output name=upload_url::${UPLOAD_URL}"
|
|
|
|
- name: Download CodeQL CLI and Bundle
|
|
run: |
|
|
wget --no-verbose "https://github.com/${GITHUB_REPOSITORY}/releases/download/${RELEASE_TAG}/codeql-bundle.tar.gz"
|
|
wget --no-verbose "https://github.com/github/codeql-cli-binaries/releases/download/${CLI_RELEASE}/codeql-${{matrix.platform}}.zip"
|
|
|
|
- name: Create Platform Package
|
|
# Replace the codeql-binaries with the platform specific ones
|
|
run: |
|
|
gunzip codeql-bundle.tar.gz
|
|
tar -f codeql-bundle.tar --delete codeql
|
|
unzip -q codeql-${{matrix.platform}}.zip
|
|
tar -f codeql-bundle.tar --append codeql
|
|
gzip codeql-bundle.tar
|
|
mv codeql-bundle.tar.gz codeql-bundle-${{matrix.platform}}.tar.gz
|
|
du -sh codeql-bundle-${{matrix.platform}}.tar.gz
|
|
|
|
- name: Upload Platform Package
|
|
uses: actions/upload-release-asset@v1
|
|
if: matrix.language == 'cpp' # Only once per platform, cpp is arbitrary
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.save_url.outputs.upload_url }}
|
|
asset_path: ./codeql-bundle-${{matrix.platform}}.tar.gz
|
|
asset_name: codeql-bundle-${{matrix.platform}}.tar.gz
|
|
asset_content_type: application/tar+gzip
|
|
|
|
- name: Create Platform-Language Package
|
|
# Replace the codeql-binaries with the platform specific ones
|
|
run: |
|
|
gunzip codeql-bundle-${{matrix.platform}}.tar.gz
|
|
[ "${{matrix.language}}" != "cpp" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/cpp --delete ql/cpp
|
|
[ "${{matrix.language}}" != "csharp" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/csharp --delete ql/csharp
|
|
[ "${{matrix.language}}" != "go" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/go --delete codeql-go
|
|
[ "${{matrix.language}}" != "java" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/java --delete ql/java
|
|
[ "${{matrix.language}}" != "javascript" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/javascript --delete ql/javascript
|
|
[ "${{matrix.language}}" != "python" ] && tar -f codeql-bundle-${{matrix.platform}}.tar --delete codeql/python --delete ql/python
|
|
gzip codeql-bundle-${{matrix.platform}}.tar
|
|
mv codeql-bundle-${{matrix.platform}}.tar.gz codeql-bundle-${{matrix.platform}}-${{matrix.language}}.tar.gz
|
|
du -sh codeql-bundle-${{matrix.platform}}-${{matrix.language}}.tar.gz
|
|
|
|
- name: Upload Language Package
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.save_url.outputs.upload_url }}
|
|
asset_path: ./codeql-bundle-${{matrix.platform}}-${{matrix.language}}.tar.gz
|
|
asset_name: codeql-bundle-${{matrix.platform}}-${{matrix.language}}.tar.gz
|
|
asset_content_type: application/tar+gzip |