Skip to content

Commit

Permalink
added releaser workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Maziar110 committed May 1, 2022
1 parent b9e8855 commit b6bf3db
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/releaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Teleport Releaser

on:
release:
types: [published]


jobs:
packer:
strategy:
matrix:
os: ['linux', 'amd64', 'arm64']
runs-on: ubuntu-latest
steps:

- name : clone teleport
uses: actions/checkout@v2

- name: Go environment
uses: actions/[email protected]
with:
go-version: 1.18

# building go package based on os version - we use release tag for version
- name: ABC Package for Linux and Darwin-amd64
if: ${{matrix.os == 'linux'}}
run: go build -o "teleport" .
env:
GOOS: linux
GOARCH: amd64

- name: Package for Darwin-Arm64
if: ${{matrix.os == 'arm64'}}
run: go build -o "teleport-mac" .
env:
GOOS: darwin
GOARCH: arm64

- name: Package for Darwin-AMD64
if: ${{matrix.os == 'amd64'}}
run: go build -o "teleport-mac-amd" .
env:
GOOS: darwin
GOARCH: amd64


# creating zip files for each os
- name: Zip
run: sudo apt -y update && sudo apt -y install zip

- name: Packing into zip for Linux
if: ${{matrix.os == 'linux'}}
run: zip -r "teleport.zip" "teleport"

- name: Packing into zip for Darwin-arm64
if: ${{matrix.os == 'arm64'}}
run: zip -r "-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "teleport-mac"

- name: Packing into zip for Darwin-amd64
if: ${{matrix.os == 'amd64'}}
run: zip -r "-${{matrix.os}}-${{github.event.release.tag_name}}.zip" "teleport-mac-amd"

- name: show where we are
run: echo $(pwd)

# Uploading the package to it's release based on release tag
- name: Upload binaries to release for Linux
if: ${{matrix.os != 'amd64' && matrix.os != 'arm64'}}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.RELEASER}}
file: "teleport.zip"
asset_name: "teleport.zip"
tag: ${{github.event.release.tag_name}}

- name: Upload binaries to release for amd64 and arm64
if: ${{matrix.os == 'amd64' || matrix.os == 'arm64' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.RELEASER}}
file: "teleport-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
asset_name: "teleport-${{matrix.os}}-${{github.event.release.tag_name}}.zip"
tag: ${{github.event.release.tag_name}}
Binary file removed teleport
Binary file not shown.

0 comments on commit b6bf3db

Please sign in to comment.