feat(ci): better rust CI
This commit is contained in:
parent
c6c5ae1496
commit
4c6217c48b
@ -15,6 +15,9 @@
|
|||||||
!PluralKit.sln
|
!PluralKit.sln
|
||||||
!nuget.config
|
!nuget.config
|
||||||
|
|
||||||
|
# used for target binary builds
|
||||||
|
!.docker-bin/
|
||||||
|
|
||||||
# Re-exclude host build artifact directories
|
# Re-exclude host build artifact directories
|
||||||
**/bin
|
**/bin
|
||||||
**/obj
|
**/obj
|
||||||
|
@ -21,21 +21,36 @@ jobs:
|
|||||||
if: github.repository == 'PluralKit/PluralKit'
|
if: github.repository == 'PluralKit/PluralKit'
|
||||||
steps:
|
steps:
|
||||||
- uses: docker/login-action@v1
|
- uses: docker/login-action@v1
|
||||||
|
if: ${{ !env.ACT }}
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
# main docker build
|
||||||
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
- run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||||
- uses: docker/build-push-action@v2
|
- uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
# https://github.com/docker/build-push-action/issues/378
|
# https://github.com/docker/build-push-action/issues/378
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile.rust
|
file: Dockerfile.rust
|
||||||
push: true
|
push: false
|
||||||
tags: |
|
cache-from: type=gha
|
||||||
ghcr.io/pluralkit/api:${{ env.BRANCH_NAME }}
|
cache-to: type=gha
|
||||||
ghcr.io/pluralkit/api:${{ github.sha }}
|
outputs: .docker-bin
|
||||||
ghcr.io/pluralkit/api:latest
|
|
||||||
cache-from: type=registry,ref=ghcr.io/pluralkit/pluralkit:${{ env.BRANCH_NAME }}
|
# add more binaries here
|
||||||
cache-to: type=inline
|
- run: |
|
||||||
|
for binary in "api"; do
|
||||||
|
for tag in latest ${{ env.BRANCH_NAME }} ${{ github.sha }}; do
|
||||||
|
cat Dockerfile.bin | sed "s/__BINARY__/$binary/g" | docker build -t ghcr.io/pluralkit/$binary/$tag -f - .
|
||||||
|
done
|
||||||
|
if [ "${{ github.repository }}" == "PluralKit/PluralKit" ]; then
|
||||||
|
docker push ghcr.io/pluralkit/$binary:${{ env.BRANCH_NAME }}
|
||||||
|
docker push ghcr.io/pluralkit/$binary:${{ github.sha }}
|
||||||
|
[ "${{ env.BRANCH_NAME }}" == "main" ] && docker push ghcr.io/pluralkit/$binary:latest
|
||||||
|
fi
|
||||||
|
done
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,4 +26,5 @@ pluralkit.*.conf
|
|||||||
# Generated
|
# Generated
|
||||||
logs/
|
logs/
|
||||||
.version
|
.version
|
||||||
recipe.json
|
recipe.json
|
||||||
|
.docker-bin/
|
5
Dockerfile.bin
Normal file
5
Dockerfile.bin
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
COPY /.docker-bin/__BINARY__ /bin/__BINARY__
|
||||||
|
|
||||||
|
CMD ["/bin/__BINARY__"]
|
Loading…
Reference in New Issue
Block a user