Skip to content

bump GH actions #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
name: Publish
on:
pull_request:
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
uses: actions/checkout@v3

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

- name: Login to DockerHub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
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: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
reactnativecommunity/react-native-android
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}
- name: Build & publish to Docker Hub
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.tags.outputs.tags }}