Skip to content

Commit 6c47fb5

Browse files
authored
bump GH actions (#207)
1 parent 15b40f2 commit 6c47fb5

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
11
name: Publish
22
on:
3+
pull_request:
34
release:
45
types: [published]
56

67
jobs:
78
publish_to_dockerhub:
89
name: Publish to Docker Hub
910
runs-on: ubuntu-22.04
10-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
1111
steps:
1212
- name: Check out the repo
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414

1515
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v1
16+
uses: docker/setup-buildx-action@v2
1717

1818
- name: Login to DockerHub
19-
uses: docker/login-action@v1
19+
if: github.event_name != 'pull_request'
20+
uses: docker/login-action@v2
2021
with:
2122
username: ${{ secrets.DOCKER_USERNAME }}
2223
password: ${{ secrets.DOCKER_PASSWORD }}
23-
24-
- name: Prepare tags
25-
env:
26-
DOCKER_IMAGE: reactnativecommunity/react-native-android
27-
STABLE_MAJOR: 1
28-
id: tags
29-
run: |
30-
VERSION=${GITHUB_REF#refs/tags/v}
31-
MAJOR=$(echo $VERSION | cut -d'.' -f 1)
32-
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:$MAJOR"
33-
if [[ $MAJOR == $STABLE_MAJOR ]]; then
34-
TAGS="$TAGS,$DOCKER_IMAGE:latest"
35-
fi
36-
echo ::set-output name=tags::${TAGS}
37-
24+
- name: Docker meta
25+
id: meta
26+
uses: docker/metadata-action@v4
27+
with:
28+
flavor: |
29+
latest=false
30+
images: |
31+
reactnativecommunity/react-native-android
32+
tags: |
33+
type=ref,event=pr
34+
type=semver,pattern={{version}}
35+
type=semver,pattern={{major}}
3836
- name: Build & publish to Docker Hub
39-
uses: docker/build-push-action@v2
37+
uses: docker/build-push-action@v4
4038
with:
41-
push: true
39+
push: ${{ github.event_name != 'pull_request' }}
4240
tags: ${{ steps.tags.outputs.tags }}

0 commit comments

Comments
 (0)