Skip to content

Commit

Permalink
CI: Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed May 29, 2024
1 parent 792167a commit d2f43e4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 35 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/docker-publish-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
types: [released]

env:
ASF_PRIVATE_SNK: ${{ secrets.ASF_PRIVATE_SNK }}
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: latest

Expand Down Expand Up @@ -40,15 +39,6 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prepare private key for signing
shell: sh
run: |
set -eu
if [ -n "${ASF_PRIVATE_SNK-}" ]; then
echo "$ASF_PRIVATE_SNK" | base64 -d > "resources/ArchiSteamFarm.snk"
fi
- name: Prepare environment outputs
shell: sh
run: |
Expand All @@ -67,7 +57,9 @@ jobs:
platforms: ${{ env.PLATFORMS }}
provenance: true
sbom: true
secrets: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
secrets: |
ASF_PRIVATE_SNK=${{ secrets.ASF_PRIVATE_SNK }}
STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}
org.opencontainers.image.version=${{ env.FIXED_TAG }}
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/docker-publish-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- main

env:
ASF_PRIVATE_SNK: ${{ secrets.ASF_PRIVATE_SNK }}
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: main

Expand Down Expand Up @@ -41,15 +40,6 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prepare private key for signing
shell: sh
run: |
set -eu
if [ -n "${ASF_PRIVATE_SNK-}" ]; then
echo "$ASF_PRIVATE_SNK" | base64 -d > "resources/ArchiSteamFarm.snk"
fi
- name: Prepare environment outputs
shell: sh
run: |
Expand All @@ -66,7 +56,9 @@ jobs:
platforms: ${{ env.PLATFORMS }}
provenance: true
sbom: true
secrets: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
secrets: |
ASF_PRIVATE_SNK=${{ secrets.ASF_PRIVATE_SNK }}
STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}
org.opencontainers.image.version=${{ github.sha }}
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/docker-publish-released.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- '*'

env:
ASF_PRIVATE_SNK: ${{ secrets.ASF_PRIVATE_SNK }}
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: released

Expand Down Expand Up @@ -41,15 +40,6 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Prepare private key for signing
shell: sh
run: |
set -eu
if [ -n "${ASF_PRIVATE_SNK-}" ]; then
echo "$ASF_PRIVATE_SNK" | base64 -d > "resources/ArchiSteamFarm.snk"
fi
- name: Prepare environment outputs
shell: sh
run: |
Expand All @@ -67,7 +57,9 @@ jobs:
platforms: ${{ env.PLATFORMS }}
provenance: true
sbom: true
secrets: STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
secrets: |
ASF_PRIVATE_SNK=${{ secrets.ASF_PRIVATE_SNK }}
STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}
org.opencontainers.image.version=${{ env.FIXED_TAG }}
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ COPY Directory.Build.props Directory.Build.props
COPY Directory.Packages.props Directory.Packages.props
COPY LICENSE.txt LICENSE.txt

RUN --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
RUN --mount=type=secret,id=ASF_PRIVATE_SNK --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
set -eu

dotnet --info
Expand All @@ -51,6 +51,12 @@ RUN --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
*) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;;
esac

if [ -f "/run/secrets/ASF_PRIVATE_SNK" ]; then
base64 -d "/run/secrets/ASF_PRIVATE_SNK" > "resources/ArchiSteamFarm.snk"
else
echo "WARN: No ASF_PRIVATE_SNK provided!"
fi

dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out" -p:ASFVariant=docker -p:ContinuousIntegrationBuild=true -p:UseAppHost=false -r "$asf_variant" --nologo --no-self-contained

if [ -f "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN" ]; then
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile.Service
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ COPY Directory.Build.props Directory.Build.props
COPY Directory.Packages.props Directory.Packages.props
COPY LICENSE.txt LICENSE.txt

RUN --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
RUN --mount=type=secret,id=ASF_PRIVATE_SNK --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
set -eu

dotnet --info
Expand All @@ -51,6 +51,12 @@ RUN --mount=type=secret,id=STEAM_TOKEN_DUMPER_TOKEN <<EOF
*) echo "ERROR: Unsupported CPU architecture: ${TARGETARCH}"; exit 1 ;;
esac

if [ -f "/run/secrets/ASF_PRIVATE_SNK" ]; then
base64 -d "/run/secrets/ASF_PRIVATE_SNK" > "resources/ArchiSteamFarm.snk"
else
echo "WARN: No ASF_PRIVATE_SNK provided!"
fi

dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -o "out" "-p:ASFVariant=${asf_variant}" -p:ContinuousIntegrationBuild=true -p:PublishSingleFile=true -p:PublishTrimmed=true -r "$asf_variant" --nologo --self-contained

if [ -f "/run/secrets/STEAM_TOKEN_DUMPER_TOKEN" ]; then
Expand Down

0 comments on commit d2f43e4

Please sign in to comment.