|
| 1 | +name: ubuntu-spins |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - ubuntu-spins |
| 7 | + paths-ignore: |
| 8 | + - '.github/workflows/**' |
| 9 | + schedule: |
| 10 | + - cron: '0 4 * * 1' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +env: |
| 14 | + BRANCH: ubuntu-spins |
| 15 | + GITHUB_ENDPOINT: netbootxyz/asset-mirror |
| 16 | + DISCORD_HOOK_URL: ${{ secrets.DISCORD_HOOK_URL }} |
| 17 | + BUILD_TYPE: direct_file |
| 18 | + DEBIAN_FRONTEND: noninteractive |
| 19 | + CI_TOKEN: ${{ secrets.CI_TOKEN }} |
| 20 | + |
| 21 | +jobs: |
| 22 | + version-checker: |
| 23 | + name: Version Checker |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ubuntu-spins |
| 29 | + |
| 30 | + - name: Get SHA of actual branch instead of master |
| 31 | + run: | |
| 32 | + export GITHUB_SHA=$(git rev-parse HEAD) |
| 33 | + echo "GITHUB_SHA=$GITHUB_SHA" >> $GITHUB_ENV |
| 34 | +
|
| 35 | + - name: Retrieve latest version from upstream and set vars |
| 36 | + run: | |
| 37 | + export EXTERNAL_VERSION=$(sudo bash version.sh) |
| 38 | + echo "EXTERNAL_VERSION=$EXTERNAL_VERSION" >> $GITHUB_ENV |
| 39 | + export GITHUB_TAG=${EXTERNAL_VERSION}-$(echo ${{ env.GITHUB_SHA }} | cut -c1-8) |
| 40 | + echo "GITHUB_TAG=$GITHUB_TAG" >> $GITHUB_ENV |
| 41 | + wget https://raw.githubusercontent.com/netbootxyz/build-pipelines/master/build.sh && chmod +x build.sh |
| 42 | +
|
| 43 | + - name: Compare tag |
| 44 | + id: compare |
| 45 | + run: ./build.sh compare ${{ env.GITHUB_TAG }} |
| 46 | + continue-on-error: true |
| 47 | + |
| 48 | + - name: Build if newer tag is available |
| 49 | + if: steps.compare.outcome == 'success' && steps.compare.conclusion == 'success' |
| 50 | + run: | |
| 51 | + ./build.sh build ${{ env.BUILD_TYPE }} |
| 52 | + git tag ${{ env.GITHUB_TAG }} |
| 53 | +
|
| 54 | + - name: Generate Release Notes |
| 55 | + run: | |
| 56 | + echo "Release generated for Branch: **${{ env.BRANCH }}**" > ${{ github.workspace }}-CHANGELOG.txt |
| 57 | +
|
| 58 | + - name: Create release and upload assets |
| 59 | + if: steps.compare.outcome == 'success' && steps.compare.conclusion == 'success' |
| 60 | + uses: softprops/action-gh-release@v2 |
| 61 | + with: |
| 62 | + tag_name: ${{ env.GITHUB_TAG }} |
| 63 | + name: ${{ env.GITHUB_TAG }} |
| 64 | + draft: false |
| 65 | + prerelease: false |
| 66 | + files: buildout/* |
| 67 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + body_path: ${{ github.workspace }}-CHANGELOG.txt |
| 69 | + |
| 70 | + - name: Generate endpoints |
| 71 | + if: steps.compare.outcome == 'success' && steps.compare.conclusion == 'success' |
| 72 | + run: | |
| 73 | + git config --global user.name netboot-ci |
| 74 | + git config --global user.email [email protected] |
| 75 | + ./build.sh endpoints ${{ env.GITHUB_TAG }} |
| 76 | +
|
| 77 | + - name: Notify Discord on failure |
| 78 | + if: failure() |
| 79 | + run: | |
| 80 | + ./build.sh discord failure |
| 81 | +
|
| 82 | + - name: Notify Discord on completion |
| 83 | + if: steps.compare.outcome == 'success' && steps.compare.conclusion == 'success' && success() |
| 84 | + run: | |
| 85 | + ./build.sh discord success |
0 commit comments