Skip to content

Commit

Permalink
Update go.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
anurnomeru authored Feb 8, 2021
1 parent 319a8aa commit 7c4e2d6
Showing 1 changed file with 33 additions and 41 deletions.
74 changes: 33 additions & 41 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,52 @@ name: release
on:
push:
tags:
- "v*"
- "v*"

jobs:
release-nhctl:
name: Release nhctl

build-syncthing-linux-amd64:
name: Build syncthing amd64
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14

- name: Checkout nocalhost
uses: actions/[email protected]
with:
repository: nocalhost/nocalhost
ref: feature/actions/syncthing

- name: Get tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15.6

- name: Get commit id
run: echo "NH_COMMIT_ID=$(git describe --match=NeVeRmAtCh --always --abbrev=40 --dirty)" >> $GITHUB_ENV
- name: Get tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Checkout syncthing
uses: actions/[email protected]
with:
repository: nocalhost/syncthing
path: ./syncthing-source
ref: nh-release
- name: Checkout syncthing
uses: actions/[email protected]
with:
repository: nocalhost/syncthing
path: ./syncthing-source
ref: main

- name: Build syncthing
working-directory: ./syncthing-source
run: ./build.sh artifact all ${{ env.RELEASE_VERSION }} ${{ env.NH_COMMIT_ID }}
- name: Build syncthing-amd64
working-directory: ./syncthing-source
run: go run build.go -targetName=syncthing -cmd=tar -nocalhostVersion=${{ env.RELEASE_VERSION }} -nocalhostCommitId="${GITHUB_SHA}"

- name: Push to Coding Articact
working-directory: ./syncthing-source
env:
VERSION: ${{ env.RELEASE_VERSION }}
run: |
curl -T syncthing-linux-amd64.tar.gz -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-linux-amd64.tar.gz?version=${VERSION}"
curl -T syncthing-linux-arm64.tar.gz -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-linux-arm64.tar.gz?version=${VERSION}"
curl -T syncthing-macos-amd64.zip -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-macos-amd64.zip?version=${VERSION}"
curl -T syncthing-windows-amd64.zip -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-windows-amd64.zip?version=${VERSION}"
- name: Push to Coding Articact
working-directory: ./syncthing-source
run: |
curl -T syncthing-linux-amd64.tar.gz -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-linux-amd64.tar.gz?version=${{ env.RELEASE_VERSION }}"
build-syncthing-windows:
name: Build syncthing windows
runs-on: windows-latest
build-syncthing-macos:
name: Build syncthing macos
runs-on: macos-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15.6

- name: Get tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Checkout syncthing
uses: actions/[email protected]
with:
Expand All @@ -68,10 +59,11 @@ jobs:
- name: Build syncthing
working-directory: ./syncthing-source
run: |
set RELEASE_VERSION="${{github.ref}}".Split("/")["${{github.ref}}".Split("/").Length -1]
go run build.go -targetName=syncthing -cmd=zip -nocalhostVersion="$RELEASE_VERSION" -nocalhostCommitId=%GITHUB_SHA%
go run build.go -targetName=syncthing -cmd=zip -nocalhostVersion=${{ env.RELEASE_VERSION }} -nocalhostCommitId="${GITHUB_SHA}"
go run build.go -targetName=syncthing -cmd=zip -nocalhostVersion=${{ env.RELEASE_VERSION }} -nocalhostCommitId="${GITHUB_SHA}" -goos=windows
- name: Push to Coding Articact
working-directory: ./syncthing-source
run: |
curl -T syncthing-windows-amd64.zip -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-windows-amd64.zip?version=$RELEASE_VERSION"
curl -T syncthing-macos-amd64.zip -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-macos-amd64.zip?version=${{ env.RELEASE_VERSION }}"
curl -T syncthing-windows-amd64.zip -u ${{ secrets.CODING_ARTIFACTS_USER }}:${{ secrets.CODING_ARTIFACTS_PASS }} "https://codingcorp-generic.pkg.coding.net/nocalhost/syncthing/syncthing-windows-amd64.zip?version=${{ env.RELEASE_VERSION }}"

0 comments on commit 7c4e2d6

Please sign in to comment.