Updates: auth setting names to be same as on the device. #65
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/release.yml | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-release: | |
name: deploy | |
permissions: | |
contents: write | |
runs-on: ${{ matrix.os }} | |
env: | |
# For some builds, we use cross to test on 32-bit and big-endian | |
# systems. | |
CARGO: cargo | |
# When CARGO is set to CROSS, this is set to `--target matrix.target`. | |
TARGET_FLAGS: "" | |
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target. | |
TARGET_DIR: ./target | |
# Emit backtraces on panics. | |
RUST_BACKTRACE: 1 | |
strategy: | |
matrix: | |
build: | |
- linux | |
- macos | |
- windows | |
include: | |
- build: linux | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
- build: linux-musl | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
- build: macos | |
os: macos-12 | |
rust: stable | |
target: x86_64-apple-darwin | |
- build: macos-aarch64 | |
os: macos-12 | |
rust: stable | |
target: aarch64-apple-darwin | |
- build: windows | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-pc-windows-gnu | |
- build: windows-32 | |
os: ubuntu-22.04 | |
rust: stable | |
target: i686-pc-windows-gnu | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
- name: Use Cross | |
shell: bash | |
run: | | |
cargo install cross | |
echo "CARGO=cross" >> $GITHUB_ENV | |
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV | |
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | |
- name: Show command used for Cargo | |
run: | | |
echo "cargo command is: ${{ env.CARGO }}" | |
echo "target flag is: ${{ env.TARGET_FLAGS }}" | |
echo "target dir is: ${{ env.TARGET_DIR }}" | |
- name: Build release binary | |
run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} | |
- name: Strip release binary (linux and macos) | |
if: matrix.build == 'linux' || matrix.build == 'macos' | |
run: strip "target/${{ matrix.target }}/release/screenly" | |
- name: Package | |
shell: bash | |
run: | | |
cd target/${{ matrix.target }}/release | |
if [[ "${{ matrix.build }}" == windows* ]]; then | |
zip ../../../screenly-cli-${{ matrix.target }}.zip screenly.exe | |
else | |
tar czvf ../../../screenly-cli-${{ matrix.target }}.tar.gz screenly | |
fi | |
cd - | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
# TODO: if any of the build step fails, the release should be deleted. | |
with: | |
files: 'screenly*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-docker-image: | |
name: docker | |
needs: build-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build container | |
run: | | |
docker build . \ | |
--build-arg "RELEASE=$GITHUB_REF_NAME" \ | |
-t "screenly/cli:$GITHUB_REF_NAME" | |
- name: Tag container | |
run: | | |
docker tag \ | |
"screenly/cli:$GITHUB_REF_NAME" \ | |
"screenly/cli:latest" | |
- name: Login to DockerHub | |
if: success() && github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push Docker containers | |
run: | | |
docker push "screenly/cli:$GITHUB_REF_NAME" | |
docker push "screenly/cli:latest" |