|
| 1 | +# GitHub Actions Setup for Docker Hub Publishing |
| 2 | + |
| 3 | +This repository uses GitHub Actions to automatically build and push the Docker image to Docker Hub whenever changes are made to the repository. |
| 4 | + |
| 5 | +## Setup Instructions |
| 6 | + |
| 7 | +### 1. Configure Docker Hub Secrets |
| 8 | + |
| 9 | +You need to add the following secrets to your GitHub repository: |
| 10 | + |
| 11 | +1. Go to your repository on GitHub |
| 12 | +2. Navigate to **Settings** → **Secrets and variables** → **Actions** |
| 13 | +3. Add the following repository secrets: |
| 14 | + |
| 15 | +- `DOCKER_USERNAME`: Your Docker Hub username |
| 16 | +- `DOCKER_PASSWORD`: Your Docker Hub access token (see below for 2FA setup) |
| 17 | + |
| 18 | +#### For Docker Hub accounts with 2FA enabled: |
| 19 | + |
| 20 | +Since your Docker Hub account uses 2FA, you **must** use an access token instead of your password: |
| 21 | + |
| 22 | +1. **Create a Docker Hub Access Token**: |
| 23 | + - Log in to [Docker Hub](https://hub.docker.com/) |
| 24 | + - Go to **Account Settings** → **Security** |
| 25 | + - Click **New Access Token** |
| 26 | + - Choose a descriptive name (e.g., "GitHub Actions CI") |
| 27 | + - Select permissions: **Read, Write, Delete** (for pushing images) |
| 28 | + - Click **Generate** |
| 29 | + - **Important**: Copy the token immediately as it won't be shown again |
| 30 | + |
| 31 | +2. **Add the token to GitHub Secrets**: |
| 32 | + - Use the generated access token as the value for `DOCKER_PASSWORD` |
| 33 | + - Do **NOT** use your actual Docker Hub password |
| 34 | + |
| 35 | +### 2. Workflow Triggers |
| 36 | + |
| 37 | +The workflow is configured to run: |
| 38 | +- On pushes to `master`, `main`, or `develop` branches |
| 39 | +- On pull requests to `master`, `main`, or `develop` branches (build only, no push) |
| 40 | +- Manually via the GitHub Actions interface |
| 41 | + |
| 42 | +### 3. Tags and Versions |
| 43 | + |
| 44 | +The workflow will automatically create the following tags: |
| 45 | +- `latest` (only for the default branch) |
| 46 | +- `android-28.0.3` (version tag) |
| 47 | +- Branch-specific tags for development |
| 48 | + |
| 49 | +### 4. Manual Trigger |
| 50 | + |
| 51 | +You can manually trigger the workflow: |
| 52 | +1. Go to **Actions** tab in your repository |
| 53 | +2. Select "Build and Push Docker Image" |
| 54 | +3. Click "Run workflow" |
| 55 | +4. Choose the branch and click "Run workflow" |
| 56 | + |
| 57 | +## Docker Hub Integration |
| 58 | + |
| 59 | +The workflow also updates the Docker Hub repository description with the README.md content from this repository, keeping the documentation synchronized. |
| 60 | + |
| 61 | +## Troubleshooting |
| 62 | + |
| 63 | +- Ensure Docker Hub credentials are correctly set in repository secrets |
| 64 | +- Check that the Docker Hub repository exists and you have push permissions |
| 65 | +- Verify the workflow has the necessary permissions to access secrets |
| 66 | + |
| 67 | +## Fix for Issue #3 |
| 68 | + |
| 69 | +This GitHub Actions workflow resolves [Issue #3](https://github.com/cuisines/gitlab-ci-react-native-android/issues/3) by automatically keeping the Docker Hub image in sync with the repository changes. |
0 commit comments