|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | ripunzip-version: |
7 | | - description: "what reference to checktout from google/runzip" |
| 7 | + description: What reference to checkout from google/ripunzip. Latest by default |
8 | 8 | required: false |
9 | 9 | openssl-version: |
10 | | - description: "what reference to checkout from openssl/openssl for Linux" |
| 10 | + description: What reference to checkout from openssl/openssl for Linux. Latest by default |
11 | 11 | required: false |
| 12 | + open-pr: |
| 13 | + description: Open a pull request updating the ripunzip versions committed to lfs |
| 14 | + required: false |
| 15 | + default: true # will be false on PRs |
12 | 16 | pull_request: |
13 | 17 | paths: |
14 | 18 | - .github/workflows/build-ripunzip.yml |
15 | | -env: |
16 | | - RIPUNZIP_DEFAULT: v2.0.3 |
17 | | - OPENSSL_DEFAULT: openssl-3.6.0 |
18 | 19 |
|
| 20 | +permissions: {} |
| 21 | + |
19 | 22 | jobs: |
| 23 | + versions: |
| 24 | + runs-on: ubuntu-slim |
| 25 | + outputs: |
| 26 | + ripunzip-version: ${{ inputs.ripunzip-version || steps.fetch-ripunzip-version.outputs.version }} |
| 27 | + openssl-version: ${{ inputs.openssl-version || steps.fetch-openssl-version.outputs.version }} |
| 28 | + steps: |
| 29 | + - name: Fetch latest ripunzip version |
| 30 | + id: fetch-ripunzip-version |
| 31 | + if: "!inputs.ripunzip-version" |
| 32 | + run: &fetch-version |
| 33 | + echo "version=$(gh release view --repo $REPO --json tagName --jq .tagName)" | tee -a $GITHUB_OUTPUT |
| 34 | + env: |
| 35 | + REPO: "google/ripunzip" |
| 36 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + - name: Fetch latest openssl version |
| 38 | + id: fetch-openssl-version |
| 39 | + if: "!inputs.openssl-version" |
| 40 | + run: *fetch-version |
| 41 | + env: |
| 42 | + REPO: "openssl/openssl" |
| 43 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
20 | 44 | build: |
| 45 | + needs: versions |
21 | 46 | strategy: |
22 | 47 | fail-fast: false |
23 | 48 | matrix: |
|
27 | 52 | - uses: actions/checkout@v5 |
28 | 53 | with: |
29 | 54 | repository: google/ripunzip |
30 | | - ref: ${{ inputs.ripunzip-version || env.RIPUNZIP_DEFAULT }} |
| 55 | + ref: ${{ needs.versions.outputs.ripunzip-version }} |
31 | 56 | # we need to avoid ripunzip dynamically linking into libssl |
32 | 57 | # see https://github.com/sfackler/rust-openssl/issues/183 |
33 | 58 | - if: runner.os == 'Linux' |
|
36 | 61 | with: |
37 | 62 | repository: openssl/openssl |
38 | 63 | path: openssl |
39 | | - ref: ${{ inputs.openssl-version || env.OPENSSL_DEFAULT }} |
| 64 | + ref: ${{ needs.versions.outputs.openssl-version }} |
40 | 65 | - if: runner.os == 'Linux' |
41 | 66 | name: build and install openssl with fPIC |
42 | 67 | shell: bash |
@@ -68,11 +93,74 @@ jobs: |
68 | 93 | lipo -create -output ripunzip-macos \ |
69 | 94 | -arch x86_64 target/x86_64-apple-darwin/release/ripunzip \ |
70 | 95 | -arch arm64 target/aarch64-apple-darwin/release/ripunzip |
71 | | - - uses: actions/upload-artifact@v4 |
| 96 | + - name: Archive |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + tar acf ripunzip-$RUNNER_OS.tar.zst ripunzip-$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]') |
| 100 | + - name: Upload built binary |
| 101 | + uses: actions/upload-artifact@v4 |
72 | 102 | with: |
73 | 103 | name: ripunzip-${{ runner.os }} |
74 | | - path: ripunzip-* |
| 104 | + path: ripunzip-${{ runner.os }}.tar.zst |
| 105 | + retention-days: 5 |
| 106 | + compression: 0 |
75 | 107 | - name: Check built binary |
76 | 108 | shell: bash |
77 | 109 | run: | |
| 110 | + rm -f ripunzip-*.tar.zst |
78 | 111 | ./ripunzip-* --version |
| 112 | + publish: |
| 113 | + needs: [versions, build] |
| 114 | + if: inputs.open-pr == 'true' |
| 115 | + permissions: |
| 116 | + contents: write |
| 117 | + pull-requests: write |
| 118 | + runs-on: ubuntu-slim |
| 119 | + steps: |
| 120 | + # workaround for git-lfs not being installed yet on ubuntu-slim runners |
| 121 | + - name: Ensure git-lfs is installed |
| 122 | + shell: bash |
| 123 | + run: | |
| 124 | + if which git-lfs &>/dev/null; then |
| 125 | + echo "git-lfs is already installed" |
| 126 | + exit 0 |
| 127 | + fi |
| 128 | + cd $TMP |
| 129 | + gh release download --repo git-lfs/git-lfs --pattern "git-lfs-linux-amd64-*.tar.gz" --clobber |
| 130 | + tar xzf git-lfs-linux-amd64-*.tar.gz |
| 131 | + rm git-lfs-linux-amd64-*.tar.gz |
| 132 | + cd git-lfs-* |
| 133 | + pwd | tee -a $GITHUB_PATH |
| 134 | + env: |
| 135 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 136 | + - uses: actions/checkout@v5 |
| 137 | + with: |
| 138 | + sparse-checkout: | |
| 139 | + .github |
| 140 | + misc/ripunzip |
| 141 | + lfs: true |
| 142 | + - name: Download built binaries |
| 143 | + uses: actions/download-artifact@v4 |
| 144 | + with: |
| 145 | + merge-multiple: true |
| 146 | + path: misc/ripunzip |
| 147 | + - name: Open PR |
| 148 | + shell: bash |
| 149 | + run: | |
| 150 | + git config --global user.name "github-actions[bot]" |
| 151 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 152 | + git switch -c update-ripunzip |
| 153 | + git add misc/ripunzip |
| 154 | + git commit -m "Update ripunzip binaries to version $VERSION" |
| 155 | + git push --set-upstream origin update-ripunzip --force |
| 156 | + TITLE="Update ripunzip binaries to version $VERSION" |
| 157 | + gh pr create \ |
| 158 | + --draft \ |
| 159 | + --title "$TITLE" \ |
| 160 | + --body "Automated update of ripunzip binaries." \ |
| 161 | + --assignee "$ACTOR" || |
| 162 | + (gh pr edit --title "$TITLE" --add-assignee "$ACTOR" && gh pr ready --undo) |
| 163 | + env: |
| 164 | + ACTOR: ${{ github.actor }} |
| 165 | + VERSION: ${{ needs.versions.outputs.ripunzip-version }} |
| 166 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments