-
Notifications
You must be signed in to change notification settings - Fork 51
90 lines (75 loc) · 3.07 KB
/
release.yml
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
# Creates a Site Template Release
name: Build and release Site Template
on:
workflow_dispatch:
inputs:
semantic_version:
description: 'Semantic version (major | minor | patch)'
required: true
default: 'patch'
jobs:
build_and_release:
name: Build and release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: Install NPM dependencies
run: npm install
- name: Bump version and commit
run: |
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "Release action on behalf of ${{ github.actor }}"
npm version ${{ github.event.inputs.semantic_version }} -m 'Release %s'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: false
- name: Build Site Template (using bumped version)
run: npm run build
- name: Read package.json
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./package.json
- name: Extract name and version from package.json
id: packageJson
run: |
echo ::set-output name=NAME::$(echo '${{ steps.package.outputs.content }}' | jq -r '.name')
echo ::set-output name=VERSION::$(echo '${{ steps.package.outputs.content }}' | jq -r '.version')
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.packageJson.outputs.NAME }}-${{ steps.packageJson.outputs.VERSION }}
release_name: ${{ steps.packageJson.outputs.NAME }}-${{ steps.packageJson.outputs.VERSION }}
draft: false
prerelease: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.packageJson.outputs.NAME }}-${{ steps.packageJson.outputs.VERSION }}.zip
asset_name: ${{ steps.packageJson.outputs.NAME }}-${{ steps.packageJson.outputs.VERSION }}.zip
asset_content_type: application/zip
- name: Update Site Theme E2E Repo
run: |
curl -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.SITE_THEME_REPO_WRITE_TOKEN }}" \
--request POST \
--data '{"event_type": "fetch_latest_changes", "client_payload": { "site_template_version": "${{ steps.packageJson.outputs.VERSION }}" } }' \
${{ github.api_url }}/repos/adobe/aem-site-template-standard-theme-e2e/dispatches