Merge pull request #162 from LuisAlejandro/dependabot/npm_and_yarn/ax… #166
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: Push | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
if: github.repository == 'LuisAlejandro/movie-box' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Restoring node_modules cache | |
uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} | |
- name: Login to Github Docker Registry | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin | |
- name: Pulling docker cache | |
run: | | |
GITHUB_REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') | |
docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/moviebox-build-cache || true | |
- name: Building image with cache | |
run: | | |
GITHUB_REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') | |
docker build . -t luisalejandro/movie-box:latest --cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/moviebox-build-cache | |
- name: Building project | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GIST_ID: ${{ secrets.GIST_ID }} | |
TRAKT_ID: ${{ secrets.TRAKT_ID }} | |
TRAKT_USERNAME: ${{ secrets.TRAKT_USERNAME }} | |
MOVIE_BOX_MODE: ${{ secrets.MOVIE_BOX_MODE }} | |
run: | | |
echo "GH_TOKEN=${GH_TOKEN}" > .env | |
echo "GIST_ID=${GIST_ID}" >> .env | |
echo "TRAKT_ID=${TRAKT_ID}" >> .env | |
echo "TRAKT_USERNAME=${TRAKT_USERNAME}" >> .env | |
echo "MOVIE_BOX_MODE=${MOVIE_BOX_MODE}" >> .env | |
sudo chown -R 1000:1000 . | |
make dependencies update | |
sudo chown -R runner:docker . | |
- name: Pushing docker image | |
run: | | |
GITHUB_REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]') | |
docker tag luisalejandro/movie-box:latest docker.pkg.github.com/$GITHUB_REPOSITORY/moviebox-build-cache | |
docker push docker.pkg.github.com/$GITHUB_REPOSITORY/moviebox-build-cache || true |