Skip to content

Commit

Permalink
Merge pull request #99 from git-for-windows/windows-arm64-release
Browse files Browse the repository at this point in the history
release-git: add support for arm64
  • Loading branch information
dscho authored Nov 18, 2024
2 parents 32b3e09 + 1cede4e commit bea1632
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
8 changes: 6 additions & 2 deletions .github/actions/github-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ inputs:
git_artifacts_x86_64_workflow_run_id:
description: 'ID of the git-artifacts (x86_64) workflow run'
required: true
git_artifacts_aarch64_workflow_run_id:
description: 'ID of the git-artifacts (aarch64) workflow run'
required: true
outputs:
github-release-url:
description: "The GitHub Release URL"
Expand All @@ -59,7 +62,7 @@ runs:
rev: ${{ inputs.rev }}
check-run-name: "github-release"
title: "Publish ${{ inputs.display-version }} for @${{ inputs.rev }}"
summary: "Downloading the Git artifacts from ${{ inputs.git_artifacts_x86_64_workflow_run_id }} and ${{ inputs.git_artifacts_i686_workflow_run_id }} and publishing them as a new GitHub Release at ${{ inputs.owner }}/${{ inputs.repo }}"
summary: "Downloading the Git artifacts from ${{ inputs.git_artifacts_x86_64_workflow_run_id }}, ${{ inputs.git_artifacts_i686_workflow_run_id }} and ${{ inputs.git_artifacts_aarch64_workflow_run_id }} and publishing them as a new GitHub Release at ${{ inputs.owner }}/${{ inputs.repo }}"
text: "For details, see [this run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}})."
details-url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id}}"
- name: Download bundle-artifacts (needed to push the tag)
Expand Down Expand Up @@ -97,7 +100,8 @@ runs:
artifactsOwner,
artifactsRepo,
${{ inputs.git_artifacts_i686_workflow_run_id }},
${{ inputs.git_artifacts_x86_64_workflow_run_id }}
${{ inputs.git_artifacts_x86_64_workflow_run_id }},
${{ inputs.git_artifacts_aarch64_workflow_run_id }}
)
const sha256sums = sha256sumsFromReleaseNotes(${{ toJSON(inputs.release-notes) }})
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release-git.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
git_artifacts_x86_64_workflow_run_id:
description: 'ID of the git-artifacts (x86_64) workflow run'
required: true
git_artifacts_aarch64_workflow_run_id:
description: 'ID of the git-artifacts (aarch64) workflow run'
required: true

env:
HOME: "${{github.workspace}}\\home"
Expand All @@ -17,6 +20,7 @@ env:
REPO: git
I686_WORKFLOW_RUN_ID: "${{github.event.inputs.git_artifacts_i686_workflow_run_id}}"
X86_64_WORKFLOW_RUN_ID: "${{github.event.inputs.git_artifacts_x86_64_workflow_run_id}}"
AARCH64_WORKFLOW_RUN_ID: "${{github.event.inputs.git_artifacts_aarch64_workflow_run_id}}"

jobs:
setup:
Expand Down Expand Up @@ -86,7 +90,8 @@ jobs:
context.repo.owner,
context.repo.repo,
process.env.I686_WORKFLOW_RUN_ID,
process.env.X86_64_WORKFLOW_RUN_ID
process.env.X86_64_WORKFLOW_RUN_ID,
process.env.AARCH64_WORKFLOW_RUN_ID
)
core.setOutput('display-version', result.displayVersion)
Expand Down
30 changes: 25 additions & 5 deletions github-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ const downloadAndUnZip = async (token, url, name) => {

const architectures = [
{ name: 'x86_64', infix: '-64-bit' },
{ name: 'i686', infix: '-32-bit' }
{ name: 'i686', infix: '-32-bit' },
{ name: 'aarch64', infix: '-arm64' }
]

const artifacts = [
Expand All @@ -96,11 +97,20 @@ const artifactName2Rank = (name) => {
return rank
}

const downloadBundleArtifacts = async (context, token, owner, repo, git_artifacts_i686_workflow_run_id, git_artifacts_x86_64_workflow_run_id) => {
const downloadBundleArtifacts = async (
context,
token,
owner,
repo,
git_artifacts_i686_workflow_run_id,
git_artifacts_x86_64_workflow_run_id,
git_artifacts_aarch64_workflow_run_id
) => {
for (const architecture of architectures) {
const workflowRunId = {
x86_64: git_artifacts_x86_64_workflow_run_id,
i686: git_artifacts_i686_workflow_run_id
i686: git_artifacts_i686_workflow_run_id,
aarch64: git_artifacts_aarch64_workflow_run_id
}[architecture.name]
const downloadURLs = await getWorkflowRunArtifactsURLs(context, token, owner, repo, workflowRunId)
if (architecture.name === 'x86_64') await downloadAndUnZip(token, downloadURLs['bundle-artifacts'], 'bundle-artifacts')
Expand Down Expand Up @@ -162,17 +172,27 @@ const downloadBundleArtifacts = async (context, token, owner, repo, git_artifact
return result
}

const getGitArtifacts = async (context, token, owner, repo, git_artifacts_i686_workflow_run_id, git_artifacts_x86_64_workflow_run_id) => {
const getGitArtifacts = async (
context,
token,
owner,
repo,
git_artifacts_i686_workflow_run_id,
git_artifacts_x86_64_workflow_run_id,
git_artifacts_aarch64_workflow_run_id
) => {
const fs = require('fs')
const result = []
for (const architecture of architectures) {
const workflowRunId = {
x86_64: git_artifacts_x86_64_workflow_run_id,
i686: git_artifacts_i686_workflow_run_id
i686: git_artifacts_i686_workflow_run_id,
aarch64: git_artifacts_aarch64_workflow_run_id
}[architecture.name]

const urls = await getWorkflowRunArtifactsURLs(context, token, owner, repo, workflowRunId)
for (const artifact of artifacts) {
if (architecture.name === 'aarch64' && artifact.name === 'mingit-busybox') continue
const name = `${artifact.name}-${architecture.name}`
context.log(`Downloading ${name}`)
await downloadAndUnZip(token, urls[name], name)
Expand Down

0 comments on commit bea1632

Please sign in to comment.