login to docker #5
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: Rust | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: docker build -t ghcr.io/ducc/calories:$GITHUB_SHA -t ghcr.io/ducc/calories:latest -f Dockerfile . | |
- name: Push sha | |
if: github.ref == 'refs/heads/master' | |
run: docker push ghcr.io/ducc/calories:$GITHUB_SHA | |
- name: Docker login | |
if: github.ref == 'refs/heads/master' | |
run: echo ${{ secrets.PACKAGES_ACCESS_TOKEN }} | docker login ghcr.io -u ducc --password-stdin | |
- name: Push latest | |
if: github.ref == 'refs/heads/master' | |
run: docker push ghcr.io/ducc/calories:latest |