-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (120 loc) · 4.48 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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