Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Opt: add the publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenein committed May 10, 2022
1 parent e8d8330 commit 3640e11
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 85 deletions.
73 changes: 2 additions & 71 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up the toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -36,77 +38,6 @@ jobs:
with:
command: test

- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"

- name: Install Cross
run: cargo install --locked --git https://github.com/cross-rs/cross.git

- name: Build for Raspberry Pi Zero W
run: cross build --target arm-unknown-linux-gnueabihf --release

- name: Build Changelog
id: changelog
uses: Bullrich/generate-release-changelog@master
env:
REPO: ${{ github.repository }}

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d.%H%M%S')"

- name: Create the release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.date.outputs.date }}-${{ steps.vars.outputs.sha_short }}"
release_name: "${{ steps.date.outputs.date }}-${{ steps.vars.outputs.sha_short }}"
body: "${{ steps.changelog.outputs.changelog }}"
draft: false
prerelease: false

- name: Upload rusty-tractive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.release.outputs.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tractive"
asset_name: "rusty-tractive.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Upload rusty-tractive-telegram-bot
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
upload_url: "${{ steps.release.outputs.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tractive-telegram-bot"
asset_name: "rusty-tractive-telegram-bot.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Upload rusty-tado
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ steps.release.outputs.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tado"
asset_name: "rusty-tado.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: "eigenein"
SENTRY_PROJECT: "rusty-home"
with:
version: ${{ steps.vars.outputs.sha_short }}

- name: Clippy
uses: actions-rs/clippy-check@v1
continue-on-error: true
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish

on:
release:
types: ["published"]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set versions
run: |
echo 'version = "${{ github.ref_name }}"'
sed -i -e 's/version = "0.0.0"/version = "${{ github.ref_name }}"/g' */Cargo.toml
sed -i -e 's/version = "0.0.0"/version = "${{ github.ref_name }}"/g' Cargo.lock
- name: Rustup
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Rust Cache
uses: Swatinem/rust-cache@v1

- name: Install Cross
run: cargo install --locked --git https://github.com/cross-rs/cross.git

- name: Build for Raspberry Pi Zero W
run: cross build --target arm-unknown-linux-gnueabihf --release

- name: Build Changelog
id: changelog
uses: Bullrich/generate-release-changelog@master
env:
REPO: ${{ github.repository }}

- name: Upload rusty-tractive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ github.event.release.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tractive"
asset_name: "rusty-tractive.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Upload rusty-tractive-telegram-bot
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
upload_url: "${{ github.event.release.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tractive-telegram-bot"
asset_name: "rusty-tractive-telegram-bot.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Upload rusty-tado
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: "${{ github.event.release.upload_url }}"
asset_path: "target/arm-unknown-linux-gnueabihf/release/rusty-tado"
asset_name: "rusty-tado.arm-unknown-linux-gnueabihf"
asset_content_type: "application/octet-stream"

- name: Update release
uses: tubone24/update_release@v1.3.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: ${{ steps.changelog.outputs.changelog }}
prerelease: false

- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: "eigenein"
SENTRY_PROJECT: "rusty-home"
with:
version: ${{ github.ref_name }}
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rusty-shared-opts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-shared-opts"
version = "3.0.2"
version = "0.0.0"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion rusty-shared-redis/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-shared-redis"
version = "4.0.0"
version = "0.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion rusty-shared-telegram/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-shared-telegram"
version = "6.0.0"
version = "0.0.0"
edition = "2021"
description = "Integrates Telegram Bot API"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion rusty-shared-tracing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-shared-tracing"
version = "1.0.0"
version = "0.0.0"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion rusty-tado/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-tado"
version = "0.1.1"
version = "0.0.0"
edition = "2021"
description = "🌡 Connects Rusty Home to tado°"

Expand Down
2 changes: 1 addition & 1 deletion rusty-tractive-telegram-bot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-tractive-telegram-bot"
version = "1.3.3"
version = "0.0.0"
edition = "2021"
description = "🐈📲 Connects Rusty Tractive to Telegram"

Expand Down
2 changes: 1 addition & 1 deletion rusty-tractive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rusty-tractive"
version = "1.1.10"
version = "0.0.0"
edition = "2021"
description = "🐈 Connects Rusty Home to Tractive"
build = "build.rs"
Expand Down

0 comments on commit 3640e11

Please sign in to comment.