Skip to content

upload-msi

upload-msi #409

name: Upload Windows MSI to Dolt Release
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
on:
repository_dispatch:
types: [ upload-msi ]
workflow_dispatch:
inputs:
version:
description: 'SemVer format dolt release tag, i.e. 0.24.5'
required: true
profile_bucket:
description: 'bucket of profile key for pgo builds'
required: true
profile_key:
description: 'key of profile for pgo builds'
required: true
commitish:
description: 'the dolt commit used to build the msi. if provided, used instead of version number'
required: false
default: ''
jobs:
get-release-id:
name: Get Dolt Release Id
runs-on: ubuntu-22.04
outputs:
release_id: ${{ steps.get_release.outputs.release_id }}
steps:
- name: Get Release
id: get_release
run: |
release_id="$RELEASE_ID"
if [ "$EVENT_TYPE" == "workflow_dispatch" ]; then
release_id=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dolthub/dolt/releases/tags/v${{ github.event.inputs.version }} | jq '.id')
fi
echo "release_id=$release_id" >> $GITHUB_OUTPUT
env:
EVENT_TYPE: ${{ github.event_name }}
RELEASE_ID: ${{ github.event.client_payload.release_id }}
get-version:
name: Get Version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version
id: get_version
run: |
version=""
if [ "${{ github.event_name }}" == "repository_dispatch" ]
then
version="${{ github.event.client_payload.tag }}"
else
version="${{ github.event.inputs.version }}"
fi
echo "version=$version" >> $GITHUB_OUTPUT
build-release-binaries:
needs: get-version
name: Build Release Binaries
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: dolthub/dolt
ref: ${{ github.event.inputs.commitish || format('v{0}', needs.get-version.outputs.version) }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-session-name: GitHub_to_AWS_via_FederatedOIDC
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_CORP }}
aws-region: us-west-2
- name: Get Results
id: get-results
run: aws s3api get-object --bucket="$BUCKET" --key="$KEY" dolt-cpu-profile.pprof
env:
KEY: ${{ github.event.inputs.profile_key || github.event.client_payload.profile_key }}
BUCKET: ${{ github.event.inputs.profile_bucket || github.event.client_payload.bucket }}
- name: Build PGO Binaries
id: build_binaries
run: |
latest=$(git rev-parse HEAD)
echo "commitish=$latest" >> $GITHUB_OUTPUT
GO_BUILD_VERSION=1.22 go/utils/publishrelease/buildpgobinaries.sh
env:
GO_BUILD_VERSION: "1.22"
PROFILE: ${{ format('{0}/dolt-cpu-profile.pprof', github.workspace) }}
- uses: actions/upload-artifact@v2
with:
name: dolt-windows-amd64-latest
path: go/out/dolt-windows-amd64.zip
upload-windows-msi:
needs: [get-version, get-release-id, build-release-binaries]
name: Upload Windows MSI to Dolt Release
runs-on: windows-2019
defaults:
run:
shell: powershell
steps:
- uses: actions/checkout@v2
- name: Build Windows MSI
run: |
mkdir archives
mkdir output
- uses: actions/download-artifact@v2
with:
name: dolt-windows-amd64-latest
path: archives/dolt-windows-amd64.zip
- name: Run Process.bat
run: |
./process.bat
- name: Upload MSI to Dolt Release
uses: actions/github-script@v4
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
script: |
const fs = require('fs');
const path = require('path')
try {
const data = fs.readFileSync(path.join(process.env.WORKSPACE, "output", "dolt-windows-amd64.msi"))
const res = await github.repos.uploadReleaseAsset({
owner: "dolthub",
repo: "dolt",
name: "dolt-windows-amd64.msi",
release_id: parseInt(process.env.RELEASE_ID, 10),
data,
});
console.log("Successfully uploaded windows msi", res)
} catch (err) {
console.log("Error", err);
process.exit(1);
}
env:
WORKSPACE: ${{ github.workspace }}
RELEASE_ID: ${{ needs.get-release-id.outputs.release_id }}
bump-dolt-packages:
needs: [get-version, upload-windows-msi]
runs-on: ubuntu-22.04
steps:
- name: Trigger Bump Winget
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: bump-winget
repository: dolthub/dolt
client-payload: '{"version": "${{ needs.get-version.outputs.version }}"}'
- name: Trigger Bump Chocolatey
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: bump-chocolatey
repository: dolthub/chocolatey-packages
client-payload: '{"version": "${{ needs.get-version.outputs.version }}"}'