2019-03-13 04:14:30 -07:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2020-10-05 10:44:46 -07:00
|
|
|
- main
|
2019-03-13 04:14:30 -07:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
2020-10-06 10:21:00 -07:00
|
|
|
- 'CONTRIBUTING.md'
|
|
|
|
- 'COPYING'
|
2019-03-13 04:14:30 -07:00
|
|
|
- 'docs/**'
|
2020-10-06 10:43:18 -07:00
|
|
|
- '.github/*.md'
|
|
|
|
- '.github/FUNDING.yml'
|
2019-03-13 04:14:30 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2020-09-11 23:42:26 -07:00
|
|
|
version: ${{ steps.changelog.outputs.version }}
|
2020-10-25 05:20:17 -07:00
|
|
|
skipped: ${{ steps.changelog.outputs.skipped }}
|
2019-03-13 04:14:30 -07:00
|
|
|
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"
|
2020-10-25 05:20:17 -07:00
|
|
|
skip-on-empty: "true"
|
2019-03-13 04:14:30 -07:00
|
|
|
- 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
|
2020-10-25 05:20:17 -07:00
|
|
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
2019-03-13 04:14:30 -07:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
ARTIFACT: posh-linux-amd64
|
|
|
|
- os: macos-latest
|
|
|
|
ARTIFACT: posh-darwin-amd64
|
|
|
|
- os: windows-latest
|
|
|
|
ARTIFACT: posh-windows-amd64.exe
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-10-27 04:10:22 -07:00
|
|
|
outputs:
|
|
|
|
hash_linux: ${{ steps.hash.outputs.hash_ubuntu-latest }}
|
|
|
|
hash_macos: ${{ steps.hash.outputs.hash_macos-latest }}
|
|
|
|
hash_windows: ${{ steps.hash.outputs.hash_windows-latest }}
|
2019-03-13 04:14:30 -07:00
|
|
|
steps:
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: 1.15.x
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
run: go build -o ${{ matrix.ARTIFACT }}
|
|
|
|
env:
|
|
|
|
GOARCH: "amd64"
|
2020-10-27 04:10:22 -07:00
|
|
|
- name: Hash
|
|
|
|
id: hash
|
|
|
|
run: |
|
2020-11-01 01:35:51 -07:00
|
|
|
$fileHash = Get-FileHash ${{ matrix.ARTIFACT }} -Algorithm SHA256
|
|
|
|
$fileHash.Hash | Out-File -Encoding 'UTF8' ${{ matrix.ARTIFACT }}.sha256
|
|
|
|
Write-Output "::set-output name=hash_${{ matrix.os }}::$($fileHash.Hash)"
|
|
|
|
shell: pwsh
|
2019-03-13 04:14:30 -07:00
|
|
|
- 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 }}
|
2020-10-15 04:19:08 -07:00
|
|
|
asset_path: ${{ matrix.ARTIFACT }}
|
2019-03-13 04:14:30 -07:00
|
|
|
asset_name: ${{ matrix.ARTIFACT }}
|
2020-10-27 04:10:22 -07:00
|
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload Hash Asset
|
|
|
|
id: upload-hash-asset
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
|
|
asset_path: ${{ matrix.ARTIFACT }}.sha256
|
|
|
|
asset_name: ${{ matrix.ARTIFACT }}.sha256
|
|
|
|
asset_content_type: text/plain
|
2020-11-01 04:46:24 -08:00
|
|
|
themes:
|
|
|
|
needs: release
|
|
|
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
hash_themes: ${{ steps.hash.outputs.hash_themes }}
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Zip theme files
|
|
|
|
run: |
|
|
|
|
$compress = @{
|
|
|
|
Path = "themes\*.json"
|
|
|
|
CompressionLevel = "Fastest"
|
|
|
|
DestinationPath = "themes.zip"
|
|
|
|
}
|
|
|
|
Compress-Archive @compress
|
|
|
|
- name: Hash
|
|
|
|
id: hash
|
|
|
|
run: |
|
|
|
|
$fileHash = Get-FileHash themes.zip -Algorithm SHA256
|
|
|
|
$fileHash.Hash | Out-File -Encoding 'UTF8' themes.zip.sha256
|
2020-11-01 08:22:00 -08:00
|
|
|
Write-Output "::set-output name=hash_themes::$($fileHash.Hash)"
|
2020-11-01 04:46:24 -08:00
|
|
|
- name: Upload Themes
|
|
|
|
id: upload-themes
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
|
|
asset_path: themes.zip
|
|
|
|
asset_name: themes.zip
|
|
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: Upload Themes Hash
|
|
|
|
id: upload-hash-asset
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
|
|
|
asset_path: themes.zip.sha256
|
|
|
|
asset_name: themes.zip.sha256
|
|
|
|
asset_content_type: text/plain
|
2020-09-11 23:42:26 -07:00
|
|
|
powershell:
|
|
|
|
needs: [release, artifacts]
|
2020-10-25 05:20:17 -07:00
|
|
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
2020-09-11 23:42:26 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
2020-10-15 04:19:08 -07:00
|
|
|
working-directory: ${{ github.workspace }}/packages/powershell/oh-my-posh
|
2020-09-11 23:42:26 -07:00
|
|
|
env:
|
|
|
|
PSGALLERY_KEY: ${{ secrets.PSGALLERY_KEY }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Pack and push
|
2020-10-30 23:49:57 -07:00
|
|
|
run: ./deploy.ps1 -BinVersion ${{ needs.release.outputs.version }} -ModuleVersion ${{ needs.release.outputs.version }} -Repository PSGallery -RepositoryAPIKey $env:PSGALLERY_KEY
|
2020-10-27 04:10:22 -07:00
|
|
|
scoop:
|
2020-11-01 08:22:00 -08:00
|
|
|
needs: [release, artifacts, themes]
|
2020-10-27 04:10:22 -07:00
|
|
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
|
|
|
working-directory: ${{ github.workspace }}/packages/scoop
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Update Template
|
2020-11-01 08:22:00 -08:00
|
|
|
run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -LinuxSHA ${{ needs.artifacts.outputs.hash_linux }} -WindowsSHA ${{ needs.artifacts.outputs.hash_windows }} -ThemesSHA ${{ needs.themes.outputs.hash_themes }}
|
2020-10-27 04:10:22 -07:00
|
|
|
- name: Upload Scoop JSON
|
|
|
|
id: upload-scoop-json
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
2020-11-01 04:57:57 -08:00
|
|
|
asset_path: ${{ github.workspace }}/packages/scoop/oh-my-posh.json
|
|
|
|
asset_name: oh-my-posh.json
|
2020-10-27 04:10:22 -07:00
|
|
|
asset_content_type: text/plain
|
|
|
|
- name: Upload Scoop Post Install
|
|
|
|
id: upload-scoop-post-install
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
2020-10-31 13:46:30 -07:00
|
|
|
asset_path: ${{ github.workspace }}/packages/scoop/post-install.ps1
|
2020-10-27 04:10:22 -07:00
|
|
|
asset_name: post-install.ps1
|
|
|
|
asset_content_type: text/plain
|