|
| 1 | +name: Build and Release |
| 2 | +on: |
| 3 | + schedule: [{cron: "1 1 1 * *"}] |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - anchor |
| 7 | + |
| 8 | +jobs: |
| 9 | + BuildRaw: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v2 |
| 13 | + - uses: docker/setup-qemu-action@v2 |
| 14 | + |
| 15 | + - name: Setup Dependencies |
| 16 | + run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y |
| 17 | + |
| 18 | + - name: checkout submoudles |
| 19 | + run: | |
| 20 | + git submodule init |
| 21 | + git submodule update |
| 22 | + - name: Build tarballs |
| 23 | + run: | |
| 24 | + sudo bash build.sh -s jammy -v raw -a arm64 |
| 25 | + |
| 26 | + - name: upload artifacts |
| 27 | + uses: actions/upload-artifact@v3 |
| 28 | + with: |
| 29 | + name: raw-tarballs |
| 30 | + path: fs-cook/out/*.tar.gz |
| 31 | + |
| 32 | + Create-Release: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: |
| 35 | + - BuildRaw |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + - uses: actions/download-artifact@v3 |
| 39 | + with: |
| 40 | + name: raw-tarballs |
| 41 | + - name: Compute release tag |
| 42 | + run: | |
| 43 | + udroid_version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ |
| 44 | + https://github.com/RandomCoderOrg/ubuntu-on-android \ |
| 45 | + | tail -n1 | cut -d / -f 3 | cut -d v -f 2- ) |
| 46 | + udroid_download=$( |
| 47 | + git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' \ |
| 48 | + https://github.com/RandomCoderOrg/udroid-download \ |
| 49 | + | tail -n1 | cut -d / -f 3 |
| 50 | + ) |
| 51 | + echo "VERSIONTAG=V${udroid_version}${BUILD_TYPE}PR$((${udroid_download: -2} + 1))" >> $GITHUB_ENV |
| 52 | + - name: Generate release notes |
| 53 | + run: sudo bash /home/runner/work/udroid-download/udroid-download/.github/scripts/generate-release-notes.sh |
| 54 | + - name: Create Release |
| 55 | + id: create_release |
| 56 | + uses: actions/create-release@v1 |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + with: |
| 60 | + tag_name: ${{ env.VERSIONTAG }} |
| 61 | + release_name: ${{ env.VERSIONTAG }} |
| 62 | + body_path: release.md |
| 63 | + draft: false |
| 64 | + prerelease: true |
| 65 | + - name: Sleep for sometime |
| 66 | + run: sleep 60 |
| 67 | + - name: Upload assets |
| 68 | + run: | |
| 69 | + set -x |
| 70 | + assets=() |
| 71 | + for asset in ./*.tar.gz; do |
| 72 | + assets+=("-a" "$asset") |
| 73 | + done |
| 74 | + tag_name="${VERSIONTAG}" |
| 75 | + hub release edit -F release.md "${assets[@]}" -m "$tag_name" "$tag_name" |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + - name: update json |
| 80 | + run: | |
| 81 | + sudo apt-get install python3 -y |
| 82 | + sudo python3 gen_data/gen-update-json.py --release-tag ${{ env.VERSIONTAG }} |
| 83 | + set +e |
| 84 | + git config user.name github-actions[bot] |
| 85 | + git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
| 86 | + git add distro-data.json |
| 87 | + git commit -m "AUTO: update distro-data.json" |
| 88 | + git push |
| 89 | + set -e |
0 commit comments