2019-09-17 20:12:45 +00:00
|
|
|
on:
|
|
|
|
push:
|
2019-09-19 09:41:23 +00:00
|
|
|
tags:
|
|
|
|
- '*.*.*'
|
2019-09-17 20:12:45 +00:00
|
|
|
|
2019-09-19 09:41:23 +00:00
|
|
|
name: Publish
|
2019-09-17 20:12:45 +00:00
|
|
|
|
|
|
|
jobs:
|
2019-09-19 09:41:23 +00:00
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macOS-latest]
|
2019-09-21 21:18:47 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2019-09-19 09:41:23 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@master
|
|
|
|
- name: Install nightly toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
|
|
|
- name: Cargo build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
command: build
|
|
|
|
args: --release
|
|
|
|
- name: Get the version
|
|
|
|
id: get_version
|
|
|
|
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
|
|
|
|
- name: Archive binary
|
|
|
|
run: tar cfJ cloudflare-ddns-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}.tar.xz target/release/cloudflare-ddns
|
|
|
|
- name: Save archived binary as an artifact
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: binary-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}
|
|
|
|
path: cloudflare-ddns-${{ matrix.os }}-${{ steps.get_version.outputs.VERSION }}.tar.xz
|
|
|
|
create_github_release:
|
|
|
|
name: Prepare a GitHub release
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
|
|
|
- name: Get the version
|
|
|
|
id: get_version
|
|
|
|
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
|
|
|
|
- name: Download macOS binary archive
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: binary-macOS-latest-${{ steps.get_version.outputs.VERSION }}
|
|
|
|
path: cloudflare-ddns-macOS-${{ steps.get_version.outputs.VERSION }}.tar.xz
|
|
|
|
- name: Download Linux binary archive
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: binary-ubuntu-latest-${{ steps.get_version.outputs.VERSION }}
|
|
|
|
path: cloudflare-ddns-ubuntu-${{ steps.get_version.outputs.VERSION }}.tar.xz
|
|
|
|
- name: Create release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
name: cloudflare-ddns v${{ steps.get_version.outputs.VERSION }}
|
|
|
|
files: |
|
|
|
|
LICENSE
|
2019-09-21 21:34:52 +00:00
|
|
|
cloudflare-ddns-macOS-${{ steps.get_version.outputs.VERSION }}.tar.xz
|
|
|
|
cloudflare-ddns-ubuntu-${{ steps.get_version.outputs.VERSION }}.tar.xz
|
2019-09-19 09:41:23 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_crate:
|
|
|
|
name: Publish cloudflare-ddns to crates.io
|
2019-09-17 20:12:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout latest master
|
|
|
|
uses: actions/checkout@master
|
2019-09-17 22:53:54 +00:00
|
|
|
- name: Install nightly toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
2019-09-17 20:12:45 +00:00
|
|
|
- name: Login to crates.io
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
2019-09-17 23:49:39 +00:00
|
|
|
command: login
|
2019-09-18 12:31:12 +00:00
|
|
|
args: ${{ secrets.CRATES_TOKEN }}
|
2019-09-17 20:12:45 +00:00
|
|
|
- name: Publish to crates.io
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
command: publish
|