From ddf939da85e903904e921d0d5fc28cdad50e315f Mon Sep 17 00:00:00 2001 From: Matthew John Cheetham Date: Fri, 24 Jul 2020 15:27:57 +0100 Subject: [PATCH 1/3] homebrew: add GitHub workflow to release Cask Add a GitHub workflow that is triggered on the `release` event to automatically update the `microsoft-git` Homebrew Cask on the `microsoft/git` Tap. A secret `HOMEBREW_TOKEN` with push permissions to the `microsoft/homebrew-git` repository must exist. A pull request will be created at the moment to allow for last minute manual verification. Signed-off-by: Matthew John Cheetham --- .github/workflows/release-homebrew.yml | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/release-homebrew.yml diff --git a/.github/workflows/release-homebrew.yml b/.github/workflows/release-homebrew.yml new file mode 100644 index 00000000000000..a41ff6127f592d --- /dev/null +++ b/.github/workflows/release-homebrew.yml @@ -0,0 +1,30 @@ +name: Update Homebrew Tap +on: + release: + types: [released] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - id: version + name: Compute version number + run: | + echo "::set-output name=result::$(echo $GITHUB_REF | sed -e "s/^refs\/tags\/v//")" + - id: hash + name: Compute release asset hash + uses: mjcheetham/asset-hash@v1 + with: + asset: /git-(.*)\.pkg/ + hash: sha256 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Update scalar Cask + uses: mjcheetham/update-homebrew@v1.1 + with: + token: ${{ secrets.HOMEBREW_TOKEN }} + tap: microsoft/git + name: microsoft-git + type: cask + version: ${{ steps.version.outputs.result }} + sha256: ${{ steps.hash.outputs.result }} + alwaysUsePullRequest: false From bc386a0bf04d443e143b07c576ff23b395264378 Mon Sep 17 00:00:00 2001 From: Lessley Dennington Date: Thu, 29 Apr 2021 10:28:44 -0700 Subject: [PATCH 2/3] Adding winget workflows --- .github/workflows/release-winget.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release-winget.yml diff --git a/.github/workflows/release-winget.yml b/.github/workflows/release-winget.yml new file mode 100644 index 00000000000000..c1f0c5ab282618 --- /dev/null +++ b/.github/workflows/release-winget.yml @@ -0,0 +1,23 @@ +name: "release-winget" +on: + release: + types: [released] + +jobs: + release: + runs-on: windows-latest + steps: + - name: Publish manifest with winget-create + run: | + # Get correct release asset + $github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json + $asset = $github.release.assets | Where-Object -Property name -match '64-bit.exe$' + + # Remove 'v' and 'vfs' from the version + $github.release.tag_name -match '\d.*' + $version = $Matches[0] -replace ".vfs","" + + # Download and run wingetcreate + Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe + .\wingetcreate.exe update Microsoft.Git -u $asset.browser_download_url -v $version -o manifests -t "${{ secrets.WINGET_TOKEN }}" -s + shell: powershell From 948016f0cf090212b78814b65f1ed8fd2550caee Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 25 Jun 2021 11:11:47 +0200 Subject: [PATCH 3/3] Add workflow for apt-get release This adds support for releasing to Ubuntu repositories hosted at http://packages.microsoft.com/ (hosting location for Microsoft's official apt/yum repos). This allows users to install via apt-get on Hirsute/Bionic. Details to configure appropriate repos can be found here: https://docs.microsoft.com/en-us/windows-server/administration/Linux-Package-Repository-for-Microsoft-Software). --- .github/workflows/release-apt-get.yml | 92 +++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/release-apt-get.yml diff --git a/.github/workflows/release-apt-get.yml b/.github/workflows/release-apt-get.yml new file mode 100644 index 00000000000000..454cdde2a6e50d --- /dev/null +++ b/.github/workflows/release-apt-get.yml @@ -0,0 +1,92 @@ +name: "release-apt-get" +on: + release: + types: [released] + + workflow_dispatch: + inputs: + release: + description: 'Release Id' + required: true + default: 'latest' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: "Download Repo Client" + env: + AZ_SUB: ${{ secrets.AZURE_SUBSCRIPTION }} + run: | + az storage blob download --subscription "$AZ_SUB" --account-name esrpsigningstorage -c signing-resources -n azure-repoapi-client_2.0.1_amd64.deb -f repoclient.deb --auth-mode login + + - name: "Install Repo Client" + run: | + sudo apt-get install python3-adal --yes + sudo dpkg -i repoclient.deb + rm repoclient.deb + + - name: "Configure Repo Client" + uses: actions/github-script@v3 + env: + AZURE_AAD_ID: ${{ secrets.AZURE_AAD_ID }} + AAD_CLIENT_SECRET: ${{ secrets.AAD_CLIENT_SECRET }} + with: + script: | + for (const key of ['AZURE_AAD_ID', 'AAD_CLIENT_SECRET']) { + if (!process.env[key]) throw new Error(`Required env var ${key} is missing!`) + } + const config = { + AADResource: 'https://microsoft.onmicrosoft.com/945999e9-da09-4b5b-878f-b66c414602c0', + AADTenant: '72f988bf-86f1-41af-91ab-2d7cd011db47', + AADAuthorityUrl: 'https://login.microsoftonline.com', + server: 'azure-apt-cat.cloudapp.net', + port: '443', + AADClientId: process.env.AZURE_AAD_ID, + AADClientSecret: process.env.AAD_CLIENT_SECRET, + repositoryId: '' + } + const fs = require('fs') + fs.writeFileSync('config.json', JSON.stringify(config, null, 2)) + + - name: "Get Release Asset" + id: get-asset + env: + RELEASE: ${{ github.event.inputs.release }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const { data } = await github.repos.getRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: process.env.RELEASE || 'latest' + }) + const assets = data.assets.filter(asset => asset.name.endsWith('.deb')) + if (assets.length !== 1) { + throw new Error(`Unexpected number of .deb assets: ${assets.length}`) + } + const fs = require('fs') + const buffer = await github.repos.getReleaseAsset({ + headers: { + accept: 'application/octet-stream' + }, + owner: context.repo.owner, + repo: context.repo.repo, + asset_id: assets[0].id + }) + console.log(buffer) + fs.writeFileSync(assets[0].name, Buffer.from(buffer.data)) + core.setOutput('name', assets[0].name) + + - name: "Publish to apt feed" + env: + RELEASE: ${{ github.event.inputs.release }} + run: | + repoclient -v v3 -c config.json package add --check --wait 300 ${{steps.get-asset.outputs.name}} -r ${{ secrets.HIRSUTE_REPO_ID }}