tweak ecr thing plus add mac arm forwarder #30
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
name: Release | |
on: | |
push: | |
tags: | |
- "*" | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: | |
contents: write # for release | |
jobs: | |
build-forwarder-binaries-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup toolchain install stable --profile minimal | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "release-forwarder-bin-linux" | |
- name: Build forwarder release | |
run: cargo build --release --bin forwarder | |
- run: mv target/release/forwarder target/release/forwarder-linux | |
- name: upload file | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/release/forwarder-linux | |
build-forwarder-binaries-windows-cross: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup toolchain install stable --profile minimal | |
- run: cargo install cross | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "release-forwarder-bin-linux" | |
- name: Build forwarder release | |
run: cross build --release --target x86_64-pc-windows-gnu --bin forwarder | |
- run: mv target/x86_64-pc-windows-gnu/release/forwarder.exe target/x86_64-pc-windows-gnu/release/forwarder-windows.exe | |
- name: upload file | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/x86_64-pc-windows-gnu/release/forwarder-windows.exe | |
build-forwarder-binaries-mac-x86: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup toolchain install stable --profile minimal --target x86_64-apple-darwin | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "release-forwarder-bin-macos" | |
- name: Build forwarder release | |
run: cargo build --release --target x86_64-apple-darwin --bin forwarder | |
- run: mv target/x86_64-apple-darwin/release/forwarder target/x86_64-apple-darwin/release/forwarder-macos-x86 | |
- name: Upload file | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/x86_64-apple-darwin/release/forwarder-macos-x86 | |
build-forwarder-binaries-mac-arm: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- run: rustup toolchain install stable --profile minimal --target aarch64-apple-darwin | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: "release-forwarder-bin-macos" | |
- name: Build forwarder release | |
run: cargo build --release --target aarch64-apple-darwin --bin forwarder | |
- run: mv target/aarch64-apple-darwin/release/forwarder target/aarch64-apple-darwin/release/forwarder-macos-arm | |
- name: Upload file | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/aarch64-apple-darwin/release/forwarder-macos-arm | |
build-receiver-image: | |
runs-on: ubuntu-latest | |
# Permissions to use OIDC token authentication - depot | |
permissions: | |
contents: read | |
id-token: write | |
# Allows pushing to the GitHub Container Registry | |
packages: write | |
env: | |
IMAGE_NAME: ${{ github.repository }}-receiver | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
413471642455.dkr.ecr.us-east-1.amazonaws.com/spotify-remote-receiver | |
ghcr.io/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
# log in to ecr for private image | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: log in to ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
# also do github packages | |
- name: Log in to the Github Packages Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: depot/setup-action@v1 | |
- uses: depot/build-push-action@v1 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 |