update README to move Quick Start section for better visibility and c… #18
This file contains hidden or 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: Docker Image Build | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - main | |
| types: [ closed ] | |
| env: | |
| IMAGE_NAME: discord-bot | |
| jobs: | |
| auth-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
| push: | |
| needs: auth-test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' || github.event.pull_request.merged == true | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} | |
| - name: Build image | |
| run: docker build . --file docker/Dockerfile --tag $IMAGE_NAME | |
| - name: Push image | |
| run: | | |
| IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
| COMMIT=$(echo "${{ github.sha }}") | |
| [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
| [ "$VERSION" == "main" ] && VERSION=latest | |
| echo IMAGE_ID=$IMAGE_ID | |
| echo VERSION=$VERSION | |
| docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
| docker tag $IMAGE_NAME $IMAGE_ID:$COMMIT | |
| docker push $IMAGE_ID:$VERSION | |
| docker push $IMAGE_ID:$COMMIT |