-
Notifications
You must be signed in to change notification settings - Fork 143
44 lines (39 loc) · 1.22 KB
/
publish.yml
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
name: Publish
on:
release:
types: [published]
jobs:
publish_to_dockerhub:
name: Publish to Docker Hub
runs-on: ubuntu-22.04
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
- 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: Prepare tags
env:
DOCKER_IMAGE: reactnativecommunity/react-native-android
STABLE_MAJOR: 1
id: tags
run: |
VERSION=${GITHUB_REF#refs/tags/v}
MAJOR=$(echo $VERSION | cut -d'.' -f 1)
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:$MAJOR"
if [[ $MAJOR == $STABLE_MAJOR ]]; then
TAGS="$TAGS,$DOCKER_IMAGE:latest"
fi
echo ::set-output name=tags::${TAGS}
- name: Build & publish to Docker Hub
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}