oh-my-posh/.github/workflows/release.yml
2020-10-05 17:19:05 +02:00

105 lines
3.3 KiB
YAML

name: Release
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'docs/**'
jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.changelog.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.github_token }}
skip-version-file: "true"
output-file: "false"
skip-commit: "true"
skip-on-empty: "false"
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
artifacts:
needs: release
env:
GOPATH: ${{ github.workspace }}
GO111MODULE: off
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
ARTIFACT: posh-linux-amd64
INSTALL_DEP: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- os: macos-latest
ARTIFACT: posh-darwin-amd64
INSTALL_DEP: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- os: windows-latest
ARTIFACT: posh-windows-amd64.exe
INSTALL_DEP: choco install dep
defaults:
run:
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.15.x
- name: Checkout code
uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Install dependencies
run: |
${{ matrix.INSTALL_DEP }}
dep ensure -v
- name: Build
id: build
run: go build -o ${{ matrix.ARTIFACT }}
env:
GOARCH: "amd64"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./src/github.com/${{ github.repository }}/${{ matrix.ARTIFACT }}
asset_name: ${{ matrix.ARTIFACT }}
asset_content_type: application/octet-stream
powershell:
needs: [release, artifacts]
runs-on: ubuntu-latest
defaults:
run:
shell: pwsh
working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }}/packages/powershell/oh-my-posh
env:
PSGALLERY_KEY: ${{ secrets.PSGALLERY_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Pack and push
run: ./deploy.ps1 -BinVersion ${{ needs.release.outputs.version }} -ModuleVersion ${{ needs.release.outputs.version }} -Repository PSGallery -RepositoryAPIKey $env:PSGALLERY_KEY