|
| 1 | +name: Deploy |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - '*' |
| 6 | + |
| 7 | +jobs: |
| 8 | + deploy_protectli: |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + if: contains(github.ref, 'refs/tags/protectli') |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + vendor: [ protectli ] |
| 14 | + model: [ vp66xx, vp46xx, vp2420, vp2410, V1210, V1211, V1410, V1610 ] |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Checkout all submodules |
| 20 | + run: git submodule update --init --recursive --checkout |
| 21 | + |
| 22 | + - name: Set up tag name |
| 23 | + id: tag_name |
| 24 | + run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" |
| 25 | + |
| 26 | + - name: Parse directories from tag |
| 27 | + id: parse_directories |
| 28 | + run: | |
| 29 | + tag=${{ steps.tag_name.outputs.tag }} |
| 30 | + base_dir="protectli" |
| 31 | + model=$(echo "$tag" | cut -d'_' -f1-3) |
| 32 | + release=$(echo "$tag" | cut -d'_' -f4) |
| 33 | + echo "::set-output name=base_dir::$base_dir" |
| 34 | + echo "::set-output name=model::$model" |
| 35 | + echo "::set-output name=release::$release" |
| 36 | +
|
| 37 | + # Allows downloading artifacts from a different workflow |
| 38 | + - name: Download workflow artifact |
| 39 | + uses: dawidd6/action-download-artifact@v6 |
| 40 | + with: |
| 41 | + workflow: build.yml |
| 42 | + name: "dasharo-${{ matrix.vendor }}-${{ matrix.model }}" |
| 43 | + path: "./artifacts" |
| 44 | + |
| 45 | + - name: Upload to Nextcloud |
| 46 | + env: |
| 47 | + CLOUD_URL: ${{ secrets.CLOUD_URL }} |
| 48 | + CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }} |
| 49 | + run: | |
| 50 | + BASE_URL="https://cloud.3mdeb.com/public.php/webdav" |
| 51 | + url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6) |
| 52 | + base_dir="${{ steps.parse_directories.outputs.base_dir }}" |
| 53 | + model="${{ steps.parse_directories.outputs.model }}" |
| 54 | + release="${{ steps.parse_directories.outputs.release }}" |
| 55 | + CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD" |
| 56 | +
|
| 57 | + new_name=$(echo "${{ matrix.vendor }}-${{ matrix.model }}.rom" | sed 's/-/_/g; s/.*/\L&/') |
| 58 | +
|
| 59 | + # Create release directory if it doesn't exist |
| 60 | + $CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release" |
| 61 | + $CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name" |
| 62 | + deploy_novacustom: |
| 63 | + runs-on: ubuntu-22.04 |
| 64 | + if: contains(github.ref, 'refs/tags/protectli') |
| 65 | + |
| 66 | + steps: |
| 67 | + - name: Checkout repository |
| 68 | + uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Checkout all submodules |
| 71 | + run: git submodule update --init --recursive --checkout |
| 72 | + |
| 73 | + - name: Set up tag name |
| 74 | + id: tag_name |
| 75 | + run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" |
| 76 | + |
| 77 | + - name: Parse directories from tag |
| 78 | + id: parse_directories |
| 79 | + run: | |
| 80 | + tag=${{ steps.tag_name.outputs.tag }} |
| 81 | + base_dir="novacustom" |
| 82 | + model=$(echo "$tag" | cut -d'_' -f1-3) |
| 83 | + release=$(echo "$tag" | cut -d'_' -f4) |
| 84 | + echo "::set-output name=base_dir::$base_dir" |
| 85 | + echo "::set-output name=model::$model" |
| 86 | + echo "::set-output name=release::$release" |
| 87 | +
|
| 88 | + # Allows downloading artifacts from a different workflow |
| 89 | + - name: Download workflow artifact |
| 90 | + uses: dawidd6/action-download-artifact@v6 |
| 91 | + with: |
| 92 | + workflow: build.yml |
| 93 | + name: ${{ steps.parse_directories.outputs.model}} |
| 94 | + path: "./artifacts" |
| 95 | + |
| 96 | + - name: Upload to Nextcloud |
| 97 | + env: |
| 98 | + CLOUD_URL: ${{ secrets.CLOUD_URL }} |
| 99 | + CLOUD_PASSWORD: ${{ secrets.CLOUD_PASSWORD }} |
| 100 | + run: | |
| 101 | + BASE_URL="https://cloud.3mdeb.com/public.php/webdav" |
| 102 | + url_part=$(echo "$CLOUD_URL" | cut -d'/' -f6) |
| 103 | + base_dir="${{ steps.parse_directories.outputs.base_dir }}" |
| 104 | + model="${{ steps.parse_directories.outputs.model }}" |
| 105 | + release="${{ steps.parse_directories.outputs.release }}" |
| 106 | + CURL_CMD="curl -u $url_part:$CLOUD_PASSWORD" |
| 107 | +
|
| 108 | + new_name=$(echo "${model}.rom" | sed 's/-/_/g; s/.*/\L&/') |
| 109 | +
|
| 110 | + # Create release directory if it doesn't exist |
| 111 | + $CURL_CMD -X MKCOL "$BASE_URL/$base_dir/$model/$release" |
| 112 | + $CURL_CMD -X PUT -T "artifacts/coreboot.rom" "$BASE_URL/$base_dir/$model/$release/$new_name" |
0 commit comments