2020-02-08 19:09:12 +03:00
|
|
|
name: release-cargo
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths:
|
|
|
|
- '**/Cargo.toml'
|
2020-02-10 01:16:02 +03:00
|
|
|
- '.github/workflows/**'
|
2020-02-08 19:09:12 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
2020-02-10 16:28:15 +03:00
|
|
|
env:
|
|
|
|
TAURI_DIST_DIR: tauri/test/fixture/dist
|
|
|
|
TAURI_DIR: ../test/fixture/src-tauri
|
2020-02-08 19:09:12 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
package:
|
|
|
|
- name: tauri-bundler
|
|
|
|
registryName: tauri-bundler
|
|
|
|
path: cli/tauri-bundler
|
|
|
|
publishPath: /target/package
|
|
|
|
- name: tauri-core
|
|
|
|
registryName: tauri
|
|
|
|
path: tauri
|
|
|
|
publishPath: /target/package
|
|
|
|
- name: tauri-api
|
|
|
|
registryName: tauri-api
|
|
|
|
path: tauri-api
|
2020-02-10 16:28:15 +03:00
|
|
|
publishPath: /target/package
|
2020-02-08 19:09:12 +03:00
|
|
|
- name: tauri-updater
|
|
|
|
registryName: tauri-updater
|
|
|
|
path: tauri-updater
|
2020-02-10 16:28:15 +03:00
|
|
|
publishPath: /target/package
|
2020-02-08 19:09:12 +03:00
|
|
|
- name: tauri-utils
|
|
|
|
registryName: tauri-utils
|
|
|
|
path: tauri-utils
|
2020-02-10 16:28:15 +03:00
|
|
|
publishPath: /target/package
|
2020-02-08 19:09:12 +03:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: master
|
|
|
|
toolchain: stable
|
|
|
|
- name: install webkit2gtk
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y webkit2gtk-4.0
|
|
|
|
- name: get version
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: echo ::set-env name=PACKAGE_VERSION::$(sed -nE 's/^\s*version = "(.*?)"/\1/p' Cargo.toml)
|
|
|
|
- name: check published version
|
|
|
|
run: echo ::set-env name=PUBLISHED_VERSION::$(cargo search ${{ matrix.package.registryName }} --limit 1 | sed -nE 's/^[^"]*"//; s/".*//1p' -)
|
2020-02-10 01:54:10 +03:00
|
|
|
- name: cargo login
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
2020-02-10 02:13:03 +03:00
|
|
|
run: cargo login ${{ secrets.crate_token }}
|
2020-02-08 19:09:12 +03:00
|
|
|
- name: cargo package
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: |
|
|
|
|
echo "package dir:"
|
|
|
|
ls
|
2020-02-10 16:28:15 +03:00
|
|
|
cargo package --no-verify
|
2020-02-08 19:09:12 +03:00
|
|
|
echo "We will publish:" $PACKAGE_VERSION
|
|
|
|
echo "This is current latest:" $PUBLISHED_VERSION
|
|
|
|
echo "post package dir:"
|
|
|
|
cd ${{ matrix.publishPath }}
|
|
|
|
ls
|
|
|
|
- name: cargo audit
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: |
|
|
|
|
cargo install cargo-audit
|
|
|
|
echo "# Cargo Audit" | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:05:36 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-08 19:09:12 +03:00
|
|
|
cargo audit 2>&1 | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:05:36 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-08 19:09:12 +03:00
|
|
|
- name: Publish ${{ matrix.package.name }}
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
working-directory: ${{ matrix.package.path }}
|
|
|
|
run: |
|
|
|
|
echo "# Cargo Publish" | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:05:36 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-10 16:28:15 +03:00
|
|
|
cargo publish --no-verify 2>&1 | tee -a ${{runner.workspace }}/notes.md
|
2020-02-10 17:05:36 +03:00
|
|
|
echo "\`\`\`" >> ${{runner.workspace }}/notes.md
|
2020-02-08 19:09:12 +03:00
|
|
|
- name: Create Release
|
|
|
|
id: create_crate_release
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
uses: jbolda/create-release@v1.1.0
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
|
|
|
|
release_name: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [crates.io]"
|
|
|
|
bodyFromFile: ./../notes.md
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
|
|
id: upload-release-asset
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_crate_release.outputs.upload_url }}
|
|
|
|
asset_path: ./${{ matrix.package.publishPath }}/${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.crate
|
|
|
|
asset_name: ${{ matrix.package.registryName }}-${{ env.PACKAGE_VERSION }}.crate
|
|
|
|
asset_content_type: application/x-gtar
|
|
|
|
- name: Tangle Release
|
|
|
|
id: tangle_release
|
|
|
|
if: env.PACKAGE_VERSION != env.PUBLISHED_VERSION
|
|
|
|
uses: iotaledger/gh-tangle-release@v0.5.2
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
IOTA_SEED: ${{ secrets.IOTA_SEED }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ matrix.package.name }}-v${{ env.PACKAGE_VERSION }}
|
2020-02-10 16:28:15 +03:00
|
|
|
comment: "Release ${{ matrix.package.name }} v${{ env.PACKAGE_VERSION }} [crates.io]"
|