|
| 1 | +name: Beta Media Release builds |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["dev-media"] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + changelog: |
| 17 | + name: Beta Media Release Changelog |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Create or update ref |
| 26 | + id: create-or-update-ref |
| 27 | + uses: ovsds/create-or-update-ref-action@v1 |
| 28 | + with: |
| 29 | + ref: tags/beta-media |
| 30 | + sha: ${{ github.sha }} |
| 31 | + |
| 32 | + - name: Delete beta-media tag |
| 33 | + run: git tag -d beta-media |
| 34 | + continue-on-error: true |
| 35 | + |
| 36 | + - name: changelog |
| 37 | + id: changelog |
| 38 | + run: | |
| 39 | + git tag -l |
| 40 | + npx changelogithub --output CHANGELOG.md |
| 41 | +
|
| 42 | + - name: Upload assets to beta-media release |
| 43 | + uses: softprops/action-gh-release@v2 |
| 44 | + with: |
| 45 | + body_path: CHANGELOG.md |
| 46 | + files: CHANGELOG.md |
| 47 | + prerelease: true |
| 48 | + tag_name: beta-media |
| 49 | + |
| 50 | + - name: Upload assets to github artifact |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: beta-media changelog |
| 54 | + path: ${{ github.workspace }}/CHANGELOG.md |
| 55 | + compression-level: 0 |
| 56 | + if-no-files-found: error |
| 57 | + |
| 58 | + release: |
| 59 | + needs: |
| 60 | + - changelog |
| 61 | + strategy: |
| 62 | + matrix: |
| 63 | + include: |
| 64 | + - target: "!(*musl*|*windows-arm64*|*windows7-*|*android*|*freebsd*)" # xgo and loongarch |
| 65 | + hash: "md5" |
| 66 | + - target: "linux-!(arm*)-musl*" #musl-not-arm |
| 67 | + hash: "md5-linux-musl" |
| 68 | + - target: "linux-arm*-musl*" #musl-arm |
| 69 | + hash: "md5-linux-musl-arm" |
| 70 | + - target: "windows-arm64" #win-arm64 |
| 71 | + hash: "md5-windows-arm64" |
| 72 | + - target: "windows7-*" #win7 |
| 73 | + hash: "md5-windows7" |
| 74 | + - target: "android-*" #android |
| 75 | + hash: "md5-android" |
| 76 | + - target: "freebsd-*" #freebsd |
| 77 | + hash: "md5-freebsd" |
| 78 | + |
| 79 | + name: Beta Media Release |
| 80 | + runs-on: ubuntu-latest |
| 81 | + steps: |
| 82 | + - name: Checkout |
| 83 | + uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + fetch-depth: 0 |
| 86 | + |
| 87 | + - name: Setup Go |
| 88 | + uses: actions/setup-go@v5 |
| 89 | + with: |
| 90 | + go-version: "1.25.0" |
| 91 | + |
| 92 | + - name: Setup web |
| 93 | + run: bash build.sh dev web |
| 94 | + env: |
| 95 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + FRONTEND_REPO: ${{ vars.FRONTEND_REPO }} |
| 97 | + |
| 98 | + - name: Build |
| 99 | + uses: OpenListTeam/cgo-actions@v1.2.2 |
| 100 | + with: |
| 101 | + targets: ${{ matrix.target }} |
| 102 | + musl-target-format: $os-$musl-$arch |
| 103 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 104 | + out-dir: build |
| 105 | + output: openlist-$target$ext |
| 106 | + musl-base-url: "https://github.com/OpenListTeam/musl-compilers/releases/latest/download/" |
| 107 | + x-flags: | |
| 108 | + github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=$built_at |
| 109 | + github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=The OpenList Projects Contributors <noreply@openlist.team> |
| 110 | + github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=$git_commit |
| 111 | + github.com/OpenListTeam/OpenList/v4/internal/conf.Version=$tag |
| 112 | + github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=rolling |
| 113 | +
|
| 114 | + - name: Compress |
| 115 | + run: | |
| 116 | + bash build.sh zip ${{ matrix.hash }} |
| 117 | + env: |
| 118 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 119 | + |
| 120 | + - name: Upload assets to beta-media release |
| 121 | + uses: softprops/action-gh-release@v2 |
| 122 | + with: |
| 123 | + files: build/compress/* |
| 124 | + prerelease: true |
| 125 | + tag_name: beta-media |
| 126 | + |
| 127 | + - name: Clean illegal characters from matrix.target |
| 128 | + id: clean_target_name |
| 129 | + run: | |
| 130 | + ILLEGAL_CHARS_REGEX='[":<>|*?\\/\r\n]' |
| 131 | + CLEANED_TARGET=$(echo "${{ matrix.target }}" | sed -E "s/$ILLEGAL_CHARS_REGEX//g") |
| 132 | + echo "Original target: ${{ matrix.target }}" |
| 133 | + echo "Cleaned target: $CLEANED_TARGET" |
| 134 | + echo "cleaned_target=$CLEANED_TARGET" >> $GITHUB_ENV |
| 135 | +
|
| 136 | + - name: Upload assets to github artifact |
| 137 | + uses: actions/upload-artifact@v4 |
| 138 | + with: |
| 139 | + name: beta-media builds for ${{ env.cleaned_target }} |
| 140 | + path: ${{ github.workspace }}/build/compress/* |
| 141 | + compression-level: 0 |
| 142 | + if-no-files-found: error |
0 commit comments