fix action to push image to docker hub #2
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
name: build + push to docker hub | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Docker | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Step 3: Log in to Docker Hub | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# Step 4: Build the Docker image | |
- name: Build Docker image | |
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/altserver-docker:latest . | |
# Step 5: Push the Docker image to Docker Hub | |
- name: Push Docker image | |
run: docker push ${{ secrets.DOCKER_USERNAME }}/altserver-docker:latest |