|
| 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 | + # Path to the version data file |
| 19 | + DSFR_BLOCKS_VERSION_FILE="$GITHUB_WORKSPACE/wp-dsfr-blocks/.version-data.json" |
| 20 | +
|
| 21 | + # Parse the file and extract the version |
| 22 | + DSFR_BLOCKS_VERSION=$(cat DSFR_BLOCKS_VERSION_FILE | jq .version) |
| 23 | +
|
| 24 | + # Send the version to the output |
| 25 | + echo "dsfr-blocks-version=$DSFR_BLOCKS_VERSION" >> "$GITHUB_OUTPUT" |
| 26 | +
|
| 27 | + - id: extract-theme-version |
| 28 | + name: "Extract theme version number from .version-data.json file." |
| 29 | + run: | |
| 30 | + # Path to the version data file |
| 31 | + DSFR_THEME_VERSION_FILE="$GITHUB_WORKSPACE/wp-dsfr-theme/.version-data.json" |
| 32 | +
|
| 33 | + # Parse the file and extract the version |
| 34 | + DSFR_THEME_VERSION=$(cat DSFR_THEME_VERSION_FILE | jq .version) |
| 35 | +
|
| 36 | + # Send the version to the output |
| 37 | + echo "dsfr-theme-version=$DSFR_THEME_VERSION" >> "$GITHUB_OUTPUT" |
| 38 | +
|
| 39 | + - id: dsfr-blocks-build-node |
| 40 | + name: "WP DSFR Blocks : Build project CSS and JS" |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version-file: 'package.json' |
| 44 | + - run: npm ci |
| 45 | + - run: npm run build |
| 46 | + working-directory: ./wp-dsfr-blocks |
| 47 | + |
| 48 | + - id: dsfr-theme-build-node |
| 49 | + name: "WP DSFR Theme : Build project CSS and JS" |
| 50 | + uses: actions/setup-node@v4 |
| 51 | + with: |
| 52 | + node-version-file: 'package.json' |
| 53 | + - run: npm ci |
| 54 | + - run: npm run build |
| 55 | + working-directory: ./wp-dsfr-theme |
| 56 | + |
| 57 | + - id: build-wp-dsfr-blocks-archive |
| 58 | + name: "Build WP DSFR Blocks archive" |
| 59 | + uses: actions/setup-node@v4 |
| 60 | + with: |
| 61 | + node-version-file: 'package.json' |
| 62 | + run: | |
| 63 | + npm ci |
| 64 | + npm run plugin-zip |
| 65 | + working-directory: "./wp-dsfr-blocks" |
| 66 | + |
| 67 | + - id: build-wp-dsfr-theme-archive |
| 68 | + name: "Build WP DSFR Theme archive" |
| 69 | + uses: actions/setup-node@v4 |
| 70 | + with: |
| 71 | + node-version-file: 'package.json' |
| 72 | + run: | |
| 73 | + npm ci |
| 74 | + npm run plugin-zip |
| 75 | + working-directory: "./wp-dsfr-theme" |
| 76 | + |
| 77 | + - id: upload-wp-dsfr-blocks-asset |
| 78 | + name: "Upload WP DSFR Blocks archive to the release" |
| 79 | + uses: actions/upload-release-asset@v1 |
| 80 | + env: |
| 81 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + with: |
| 83 | + upload_url: ${{ github.event.release.upload_url }} |
| 84 | + asset_path: ./wp-dsfr-blocks/wp-dsfr-blocks.zip |
| 85 | + asset_name: wp-dsfr-blocks-${{ steps.extract-plugin-version.outputs.dsfr-blocks-version }}.zip |
| 86 | + asset_content_type: application/zip |
| 87 | + |
| 88 | + - id: upload-wp-dsfr-theme-asset |
| 89 | + name: "Upload WP DSFR Theme archive to the release" |
| 90 | + uses: actions/upload-release-asset@v1 |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + with: |
| 94 | + upload_url: ${{ github.event.release.upload_url }} |
| 95 | + asset_path: ./wp-dsfr-theme/wp-dsfr-theme.zip |
| 96 | + asset_name: wp-dsfr-theme-${{ steps.extract-theme-version.outputs.dsfr-theme-version }}.zip |
| 97 | + asset_content_type: application/zip |
0 commit comments