Skip to content

Commit

Permalink
Added gh action for releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
ZloeSabo committed Feb 27, 2021
1 parent 9d1cc60 commit 7a8e854
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release_on_tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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 }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: DNS-Ear ${{ github.ref }}
body: ''
draft: false
prerelease: false

cross_compile:
name: Cross Compile
runs-on: ubuntu-latest
needs:
- create_release
strategy:
matrix:
target:
- os: i686-unknown-linux-gnu
binary: dns-ear
- os: x86_64-pc-windows-gnu
binary: dns-ear.exe
- os: x86_64-unknown-linux-gnu
binary: dns-ear
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target.os }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target.os }}
- name: Compress
shell: bash
run: |
ls -l
echo 'target' && ls -l target
echo 'release' && ls -l target/release
zip --junk-paths -r dns-ear.zip target/${{ matrix.target.os }}/release/${{ matrix.target.binary }}
- name: Upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: dns-ear.zip
asset_name: dns-ear-${{ matrix.target.os }}.zip
asset_content_type: application/zip

0 comments on commit 7a8e854

Please sign in to comment.