forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) · 1.28 KB
/
upload.yml
File metadata and controls
39 lines (34 loc) · 1.28 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
name: Upload
on:
workflow_dispatch:
workflow_run:
workflows: ["Publish"]
types:
- completed
jobs:
upload:
runs-on: ubuntu-latest
if: github.repository_owner == 'playcanvas' && (github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'))
steps:
- name: Download version
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v7
with:
name: version
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Read version
if: github.event_name == 'workflow_run'
run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Parse tag name
if: github.event_name == 'workflow_dispatch'
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "VERSION=${TAG_NAME/v/}" >> $GITHUB_ENV
- name: Upload to code.playcanvas.com
run: |
if ! curl -fsS -X POST -H "Content-Type: application/json" \
-d '{ "engineVersion": "${{ env.VERSION }}" }' ${{ secrets.PUBLISH_ENDPOINT }}; then
echo "Failed to publish to code.playcanvas.com"
exit 1
fi