-
Notifications
You must be signed in to change notification settings - Fork 22
76 lines (71 loc) · 3.13 KB
/
deploy-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
name: Deploy release
on:
check_run:
types: [ completed ]
jobs:
deploy:
concurrency: ci
if: |
github.event.check_run.app.name == 'CircleCI Checks'
&& github.event.check_run.conclusion == 'success'
&& github.event.check_run.name == 'build-deploy'
&& github.event.check_run.check_suite.head_branch == 'main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hmarr/debug-action@v2
- name: Download artifacts
run: |
curl -o unity-renderer-windows.zip https://renderer-artifacts.decentraland.org/desktop/main/unity-renderer-windows.zip
curl -o unity-renderer-mac.zip https://renderer-artifacts.decentraland.org/desktop/main/unity-renderer-mac.zip
curl -o unity-renderer-linux.zip https://renderer-artifacts.decentraland.org/desktop/main/unity-renderer-linux.zip
- name: Prepare release
run: |
zip unity-renderer.zip unity-renderer-windows.zip unity-renderer-mac.zip unity-renderer-linux.zip
- name: Set version
shell: bash
run: |
COMMIT_HASH=${{ github.event.check_run.head_sha }}
DATE=$(date '+%Y%m%d%H%M%S')
VERSION=1.0.${{github.run_number}}-${DATE}.commit-${COMMIT_HASH::7}
echo ${VERSION}
echo "##[set-output name=number;]$(echo ${VERSION})"
id: set_version
- name: Check last commit release
shell: bash
run: |
# Get current commit hash
LARGE_COMMIT_HASH=${{ github.event.check_run.head_sha }}
NEW_COMMIT_HASH=${LARGE_COMMIT_HASH::7}
# Fetch last version
LAST_VERSION=$(curl https://api.github.com/repos/decentraland/explorer-desktop/releases/latest --silent | jq '.name' -r)
echo ${LAST_VERSION}
# Get the commit from the last 7 characters of the version
LAST_COMMIT_HASH=$(echo -n "${LAST_VERSION}" | tail -c 7)
# Compare and throw error if are equal
echo "Last hash: ${LAST_COMMIT_HASH}"
echo "New hash: ${NEW_COMMIT_HASH}"
if [ "${NEW_COMMIT_HASH}" == "${LAST_COMMIT_HASH}" ]; then
echo "Error: You can't execute another release with the same commit hash that the last one"
exit 1
fi
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.set_version.outputs.number }}
files: |
unity-renderer.zip
- name: Trigger pipeline
run: |
export PACKAGE_NAME="@dcl/explorer-desktop"
curl \
--request POST \
--form token=${{ secrets.GITLAB_CDN_DEPLOYER_TOKEN }} \
--form ref=master \
--form-string variables[PACKAGE_NAME]="@dcl/explorer-desktop" \
--form variables[PACKAGE_VERSION]=${{ steps.set_version.outputs.number }} \
--form variables[REPO]=explorer-desktop \
--form variables[REPO_OWNER]=decentraland \
--form variables[COMMIT]=${{ github.event.check_run.head_sha }} \
--form variables[GITHUB_RELEASE_ARTIFACT]=unity-renderer.zip \
"${{ secrets.GITLAB_CDN_DEPLOYER_URL }}"