|
| 1 | +name: "Build release assets" |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: |
| 5 | + - published |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-archives: |
| 9 | + name: "Build archives" |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: "Checkout code" |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - id: extract-plugin-version |
| 16 | + name: "Extract plugin version number from .version-data.json file." |
| 17 | + run: | |
| 18 | + # Parse .version-data.json file and extract the version |
| 19 | + DSFR_BLOCKS_VERSION=$(cat ./wp-dsfr-blocks/.version-data.json | jq .version) |
| 20 | +
|
| 21 | + # Send the version to the output |
| 22 | + echo "dsfr-blocks-version=$DSFR_BLOCKS_VERSION" >> "$GITHUB_OUTPUT" |
| 23 | +
|
| 24 | + - id: extract-theme-version |
| 25 | + name: "Extract theme version number from .version-data.json file." |
| 26 | + run: | |
| 27 | + # Parse .version-data.json file and extract the version |
| 28 | + DSFR_THEME_VERSION=$(cat ./wp-dsfr-theme/.version-data.json | jq .version) |
| 29 | +
|
| 30 | + # Send the version to the output |
| 31 | + echo "dsfr-theme-version=$DSFR_THEME_VERSION" >> "$GITHUB_OUTPUT" |
| 32 | +
|
| 33 | + - id: dsfr-blocks-build-node |
| 34 | + name: "WP DSFR Blocks : Build project CSS and JS. Zip wp-dsfr-blocks folder." |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version-file: './wp-dsfr-blocks/package.json' |
| 38 | + - run: cd ./wp-dsfr-blocks/ && npm install && npm run build && npm run plugin-zip && cd ../ |
| 39 | + |
| 40 | + - id: dsfr-theme-build-node |
| 41 | + name: "WP DSFR Theme : Build project CSS and JS. Zip wp-dsfr-theme folder." |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version-file: './wp-dsfr-theme/package.json' |
| 45 | + - run: cd ./wp-dsfr-theme/ && npm install && npm run build && npm run plugin-zip && cd ../ |
| 46 | + |
| 47 | + - id: upload-wp-dsfr-blocks-asset |
| 48 | + name: "Upload WP DSFR Blocks archive to the release" |
| 49 | + uses: actions/upload-release-asset@v1 |
| 50 | + env: |
| 51 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + with: |
| 53 | + upload_url: ${{ github.event.release.upload_url }} |
| 54 | + asset_path: ./wp-dsfr-blocks/wp-dsfr-blocks.zip |
| 55 | + asset_name: wp-dsfr-blocks-${{ steps.extract-plugin-version.outputs.dsfr-blocks-version }}.zip |
| 56 | + asset_content_type: application/zip |
| 57 | + |
| 58 | + - id: upload-wp-dsfr-theme-asset |
| 59 | + name: "Upload WP DSFR Theme archive to the release" |
| 60 | + uses: actions/upload-release-asset@v1 |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + with: |
| 64 | + upload_url: ${{ github.event.release.upload_url }} |
| 65 | + asset_path: ./wp-dsfr-theme/wp-dsfr-theme.zip |
| 66 | + asset_name: wp-dsfr-theme-${{ steps.extract-theme-version.outputs.dsfr-theme-version }}.zip |
| 67 | + asset_content_type: application/zip |
0 commit comments