mirror of
https://github.com/pushbits/server.git
synced 2025-05-02 11:46:17 +02:00
Fix CI for pull requests
This commit is contained in:
parent
8e5a43e5a4
commit
5450d44f53
1 changed files with 4 additions and 3 deletions
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
|
@ -17,15 +17,16 @@ jobs:
|
||||||
run: make test
|
run: make test
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: make build_image
|
run: make build_image
|
||||||
- name: Get Branch
|
- name: Get Branch # Needed to evaluate env.BRANCH.
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' }} # Otherwise will fail on pull requests.
|
||||||
run: |
|
run: |
|
||||||
raw=$(git branch -r --contains ${{ github.ref }})
|
raw=$(git branch -r --contains ${{ github.ref }})
|
||||||
branch=${raw##*/}
|
branch=${raw##*/}
|
||||||
echo "BRANCH=$branch" >> $GITHUB_ENV
|
echo "BRANCH=$branch" >> $GITHUB_ENV
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && env.BRANCH == 'master' }} # Only publish for tagged commits pushed to master.
|
if: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' && env.BRANCH == 'master' }} # Only login for tagged commits pushed to master.
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with: # Secrets are not exposed to pull request contexts.
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Publish image
|
- name: Publish image
|
||||||
|
|
Loading…
Add table
Reference in a new issue