-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (84 loc) · 3.3 KB
/
build-release-assets.yml
File metadata and controls
97 lines (84 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: "Build release assets"
on: [push]
# release:
# types:
# - published
jobs:
build-archives:
name: "Build archives"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4
- id: extract-plugin-version
name: "Extract plugin version number from package.json file."
run: |
# Path to the version data file
DSFR_BLOCKS_VERSION_FILE="$GITHUB_WORKSPACE/wp-dsfr-blocks/package.json"
# Parse the file and extract the version
DSFR_BLOCKS_VERSION=$(cat DSFR_BLOCKS_VERSION_FILE | jq .version)
# Send the version to the output
echo "dsfr-blocks-version=$DSFR_BLOCKS_VERSION" >> "$GITHUB_OUTPUT"
- id: extract-theme-version
name: "Extract theme version number from package.json file."
run: |
# Path to the version data file
DSFR_THEME_VERSION_FILE="$GITHUB_WORKSPACE/wp-dsfr-theme/package.json"
# Parse the file and extract the version
DSFR_THEME_VERSION=$(cat DSFR_THEME_VERSION_FILE | jq .version)
# Send the version to the output
echo "dsfr-theme-version=$DSFR_THEME_VERSION" >> "$GITHUB_OUTPUT"
- id: dsfr-blocks-build-node
name: "WP DSFR Blocks : Build project CSS and JS"
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: npm install
- run: npm run build
working-directory: ./wp-dsfr-blocks
- id: dsfr-theme-build-node
name: "WP DSFR Theme : Build project CSS and JS"
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: npm install
- run: npm run build
working-directory: ./wp-dsfr-theme
- id: build-wp-dsfr-blocks-archive
name: "Build WP DSFR Blocks archive"
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: |
npm install
npm run plugin-zip
working-directory: "./wp-dsfr-blocks"
- id: build-wp-dsfr-theme-archive
name: "Build WP DSFR Theme archive"
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: |
npm install
npm run plugin-zip
working-directory: "./wp-dsfr-theme"
- id: upload-wp-dsfr-blocks-asset
name: "Upload WP DSFR Blocks archive to the release"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./wp-dsfr-blocks/wp-dsfr-blocks.zip
asset_name: wp-dsfr-blocks-${{ steps.extract-plugin-version.outputs.dsfr-blocks-version }}.zip
asset_content_type: application/zip
- id: upload-wp-dsfr-theme-asset
name: "Upload WP DSFR Theme archive to the release"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./wp-dsfr-theme/wp-dsfr-theme.zip
asset_name: wp-dsfr-theme-${{ steps.extract-theme-version.outputs.dsfr-theme-version }}.zip
asset_content_type: application/zip