|
| 1 | +name: Build packages |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - '*' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + release_tag: |
| 9 | + description: Release tag to build and publish |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + preparation: |
| 18 | + name: Setup build version |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + version: ${{ steps.version.outputs.version }} |
| 22 | + commitish: ${{ steps.version.outputs.commitish }} |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v5.0.0 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + - id: version |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + INPUT_VERSION="${{ inputs.release_tag || '' }}" |
| 31 | + if [ -n "$INPUT_VERSION" ]; then |
| 32 | + VERSION="$INPUT_VERSION" |
| 33 | + else |
| 34 | + VERSION=$(git describe --tags --exact-match 2>/dev/null || true) |
| 35 | + fi |
| 36 | + if [[ ! "$VERSION" =~ ^([0-9]+(\.[0-9]+)*-[0-9]+|[0-9]+(\.[0-9]+){3})$ ]]; then |
| 37 | + echo "Release version must use x.y.z.n format; legacy x.y.z-n is also accepted, got: ${VERSION:-<empty>}" >&2 |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 41 | + echo "commitish=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" |
| 42 | +
|
| 43 | + build: |
| 44 | + name: Build Podkop Plus release packages |
| 45 | + runs-on: ubuntu-latest |
| 46 | + needs: preparation |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v5.0.0 |
| 49 | + with: |
| 50 | + fetch-depth: 0 |
| 51 | + |
| 52 | + - name: Build release artifacts |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + VERSION="${{ needs.preparation.outputs.version }}" |
| 56 | + bash ./scripts/build-openwrt-packages-wsl.sh "$VERSION" "$PWD/filtered-bin/release" |
| 57 | + ls -la "$PWD/filtered-bin/release" |
| 58 | +
|
| 59 | + - name: Upload build artifacts |
| 60 | + uses: actions/upload-artifact@v4.6.2 |
| 61 | + with: |
| 62 | + name: release-files-${{ needs.preparation.outputs.version }} |
| 63 | + path: ./filtered-bin/release/* |
| 64 | + retention-days: 1 |
| 65 | + if-no-files-found: error |
| 66 | + |
| 67 | + release: |
| 68 | + name: Create Release |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: |
| 71 | + - preparation |
| 72 | + - build |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v5.0.0 |
| 75 | + - name: Create release dir |
| 76 | + run: mkdir -p ./filtered-bin/release |
| 77 | + |
| 78 | + - name: Download release artifacts |
| 79 | + uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + name: release-files-${{ needs.preparation.outputs.version }} |
| 82 | + path: ./filtered-bin/release |
| 83 | + |
| 84 | + - name: Release |
| 85 | + uses: softprops/action-gh-release@v2.4.0 |
| 86 | + with: |
| 87 | + files: ./filtered-bin/release/*.* |
| 88 | + draft: false |
| 89 | + prerelease: false |
| 90 | + make_latest: true |
| 91 | + name: ${{ needs.preparation.outputs.version }} |
| 92 | + tag_name: ${{ needs.preparation.outputs.version }} |
| 93 | + target_commitish: ${{ needs.preparation.outputs.commitish }} |
0 commit comments