Skip to content

Commit

Permalink
Attempt to add a release yaml (#8)
Browse files Browse the repository at this point in the history
* Attempt to add a release yaml

* Switch all tar usage to gtar on the OSX path

* I had forgotten to actually build on OSX

* The zip was being created in the wrong directory
  • Loading branch information
dfellis authored Feb 23, 2021
1 parent e1bf1fb commit b9dbce4
Showing 1 changed file with 122 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: Release ${{ github.ref }}
draft: false
prerelease: false
ubuntu:
needs: create_release
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Acquire alan
run: |
wget https://github.com/alantech/alan/releases/latest/download/alan-ubuntu.tar.gz
tar -xzf alan-ubuntu.tar.gz
sudo mv alan /usr/local/bin/alan
- name: Generate Anycloud tar.gz
run: |
cd cli
cargo build --release
cd ./target/release
tar -czf /tmp/anycloud-ubuntu.tar.gz anycloud
- name: Upload Anycloud tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /tmp/anycloud-ubuntu.tar.gz
asset_name: anycloud-ubuntu.tar.gz
asset_content_type: application/gzip

windows:
needs: create_release
runs-on: windows-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Acquire alan
run: |
Invoke-WebRequest -OutFile alan-windows.zip -Uri https://github.com/alantech/alan/releases/latest/download/alan-windows.zip
Expand-Archive -Path alan-windows.zip -DestinationPath C:\windows
- name: Generate Anycloud zip
run: |
cd cli
cargo build --release
cd ..
Compress-Archive -Path "$(Join-Path (Get-Location).Path '\\cli\\target\\release\\anycloud.exe')" -DestinationPath "$(Join-Path (Get-Location).Path 'anycloud-windows.zip')"
- name: Upload Anycloud zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./anycloud-windows.zip
asset_name: anycloud-windows.zip
asset_content_type: application/zip

macos:
needs: create_release
runs-on: macos-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Acquire alan
run: |
brew install gnu-tar
curl -OL https://github.com/alantech/alan/releases/latest/download/alan-macos.tar.gz
gtar -xzf alan-macos.tar.gz
sudo mkdir -p /usr/local/bin
sudo mv alan /usr/local/bin/alan
- name: Generate Anycloud tar.gz
run: |
cd cli
cargo build --release
cd ./target/release
gtar -czf /tmp/anycloud-macos.tar.gz anycloud
- name: Upload Anycloud tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: /tmp/anycloud-macos.tar.gz
asset_name: anycloud-macos.tar.gz
asset_content_type: application/gzip

0 comments on commit b9dbce4

Please sign in to comment.