Skip to content

Commit 8a6dee8

Browse files
committed
add first implementation of auto-update to release workflow (still to test)
1 parent 7e51cae commit 8a6dee8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,31 @@ jobs:
1414
- operating-system: ubuntu-18.04
1515
- operating-system: windows-2019
1616
arch: -386
17+
ext: ".exe"
1718
- operating-system: windows-2019
1819
arch: -amd64
20+
ext: ".exe"
1921
- operating-system: macos-10.15
2022

2123
runs-on: ${{ matrix.operating-system }}
24+
env:
25+
TARGET: "/CreateBridge/"
26+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
27+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
2228

2329
steps:
2430
- name: Set version
2531
run: echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
2632
shell: bash
2733

34+
- name: Identify Prerelease
35+
# This is a workaround while waiting for create-release action to implement auto pre-release based on tag
36+
id: prerelease
37+
run: |
38+
wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip
39+
unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver
40+
if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "::set-output name=IS_PRE::true"; fi
41+
2842
- name: Disable EOL conversions
2943
run: git config --global core.autocrlf false
3044

@@ -48,6 +62,7 @@ jobs:
4862
run: |
4963
go get github.com/golangci/govet
5064
go get golang.org/x/lint/golint
65+
go get -u github.com/sanbornm/go-selfupdate/...
5166
shell: bash
5267

5368
- name: Install Taskfile
@@ -97,6 +112,14 @@ jobs:
97112
run: task build
98113
if: matrix.operating-system == 'macos-10.15'
99114

115+
- name: Create autoupdate files
116+
run: ${GOPATH}/bin/go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
117+
if: steps.prerelease.outputs.IS_PRE != 'true'
118+
119+
- name: Upload autoupdate files to Arduino downloads servers
120+
run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*"
121+
if: steps.prerelease.outputs.IS_PRE != 'true'
122+
100123
# config.ini is required by the executable when it's run
101124
- name: Upload artifacts
102125
uses: actions/upload-artifact@v2

0 commit comments

Comments
 (0)