forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(gh-actions): build image for releases
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build Image for Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.commits.*.message, '[skip ci]') && !contains(github.event.commits.*.message, '[ci skip]') }} | ||
|
||
strategy: | ||
matrix: | ||
platform: [amd64, arm64, universal] | ||
|
||
steps: | ||
- name: 🔍 Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🦄 Set up Qemu for Docker | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: 🏗️ Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: 🔑 Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: ⚓ Build and push arm64 image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
pull: true | ||
push: true | ||
platforms: linux/${{ matrix.platform }} | ||
cache-from: type=registry,ref=mashirozx/mastodon:${{ github.event.release.tag_name }}-${{ matrix.platform }} | ||
cache-to: type=inline | ||
tags: mashirozx/mastodon:${{ github.event.release.tag_name }}-${{ matrix.platform }} | ||
if: ${{ matrix.platform == 'arm64' }} | ||
|
||
- name: ⚓ Build and push amd64 image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
pull: true | ||
push: true | ||
platforms: linux/${{ matrix.platform }} | ||
cache-from: type=registry,ref=mashirozx/mastodon:${{ github.event.release.tag_name }}-${{ matrix.platform }} | ||
cache-to: type=inline | ||
tags: | | ||
mashirozx/mastodon:${{ github.event.release.tag_name }}-${{ matrix.platform }} | ||
if: ${{ matrix.platform == 'amd64' }} | ||
|
||
- name: ⚓ Build and push universal image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
pull: true | ||
push: true | ||
platforms: linux/amd64, linux/arm64 | ||
cache-from: type=registry,ref=mashirozx/mastodon:${{ github.event.release.tag_name }} | ||
cache-to: type=inline | ||
tags: | | ||
mashirozx/mastodon:${{ github.event.release.tag_name }} | ||
if: ${{ matrix.platform == 'universal' }} |