-
Notifications
You must be signed in to change notification settings - Fork 8
52 lines (50 loc) · 2.04 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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