| 
 | 1 | +name: ci  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  push:  | 
 | 5 | +    branches:  | 
 | 6 | +      - '*'  | 
 | 7 | +  pull_request:  | 
 | 8 | +    branches:  | 
 | 9 | +      - '*'  | 
 | 10 | + | 
 | 11 | +jobs:  | 
 | 12 | +  ShellCheck:  | 
 | 13 | +    name: Shellcheck  | 
 | 14 | +    runs-on: ubuntu-latest  | 
 | 15 | +    steps:  | 
 | 16 | +      - uses: actions/checkout@v2  | 
 | 17 | +      - name: ShellCheck Depends  | 
 | 18 | +        uses: ludeeus/action-shellcheck@master  | 
 | 19 | +  Docker:  | 
 | 20 | +    name: Docker  | 
 | 21 | +    runs-on: ubuntu-latest  | 
 | 22 | +    needs: ShellCheck  | 
 | 23 | +    steps:  | 
 | 24 | +      - name: Checkout  | 
 | 25 | +        if: success()  | 
 | 26 | +        id: checkout  | 
 | 27 | +        uses: actions/checkout@v2  | 
 | 28 | +      - name: Set up QEMU  | 
 | 29 | +        if: success()  | 
 | 30 | +        uses: docker/setup-qemu-action@v1  | 
 | 31 | +      - name: Set up Docker Buildx  | 
 | 32 | +        if: success()  | 
 | 33 | +        id: buildx  | 
 | 34 | +        uses: docker/setup-buildx-action@v1  | 
 | 35 | +      - name: Cache Docker layers  | 
 | 36 | +        uses: actions/cache@v2  | 
 | 37 | +        with:  | 
 | 38 | +          path: /tmp/.buildx-cache  | 
 | 39 | +          key: ${{ runner.os }}-buildx-${{ github.sha }}  | 
 | 40 | +          restore-keys: |  | 
 | 41 | +            ${{ runner.os }}-buildx-  | 
 | 42 | +      - name: Prepare  | 
 | 43 | +        if: success()  | 
 | 44 | +        id: prepare  | 
 | 45 | +        run: |  | 
 | 46 | +          echo ::set-output name=docker_platforms::linux/amd64,linux/386  | 
 | 47 | +          echo ::set-output name=docker_username::miigotu  | 
 | 48 | +          VERSION_TAG=${GITHUB_REF#refs/*/}  | 
 | 49 | +          echo ::set-output name=version::${VERSION_TAG%/merge}  | 
 | 50 | +#      - name: Login to DockerHub  | 
 | 51 | +#        if: success()  | 
 | 52 | +#        id: login_docker  | 
 | 53 | +#        uses: docker/login-action@v1  | 
 | 54 | +#        with:  | 
 | 55 | +#          username: ${{ secrets.DOCKERHUB_USERNAME }}  | 
 | 56 | +#          password: ${{ secrets.DOCKERHUB_TOKEN }}  | 
 | 57 | +      - name: Login to GitHub Container Registry  | 
 | 58 | +        if: success()  | 
 | 59 | +        id: login_github  | 
 | 60 | +        uses: docker/login-action@v1  | 
 | 61 | +        with:  | 
 | 62 | +          registry: ghcr.io  | 
 | 63 | +          username: ${{ steps.prepare.outputs.docker_username }}  | 
 | 64 | +          password: ${{ secrets.GITHUB_TOKEN }}  | 
 | 65 | +      - name: Build and push (master)  | 
 | 66 | +        if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request'  | 
 | 67 | +        id: build_push_master  | 
 | 68 | +        uses: docker/build-push-action@v2  | 
 | 69 | +        with:  | 
 | 70 | +          context: .  | 
 | 71 | +          platforms: ${{ steps.prepare.outputs.docker_platforms }}  | 
 | 72 | +          push: true  | 
 | 73 | +          tags: |  | 
 | 74 | +#            ${GITHUB_REPOSITORY,,}/ps3dev:master  | 
 | 75 | +#            ${GITHUB_REPOSITORY,,}/ps3dev:latest  | 
 | 76 | +            ghcr.io/${GITHUB_REPOSITORY,,}/ps3dev:master  | 
 | 77 | +            ghcr.io/${GITHUB_REPOSITORY,,}/ps3dev:latest  | 
 | 78 | +      - name: Build and push (development)  | 
 | 79 | +        if: success() && steps.prepare.outputs.version != 'master' && github.event_name != 'pull_request'  | 
 | 80 | +        id: build_push_development  | 
 | 81 | +        uses: docker/build-push-action@v2  | 
 | 82 | +        with:  | 
 | 83 | +          context: .  | 
 | 84 | +          platforms: ${{ steps.prepare.outputs.docker_platforms }}  | 
 | 85 | +          push: true  | 
 | 86 | +          tags: |  | 
 | 87 | +#            ${GITHUB_REPOSITORY,,}/ps3dev:${{ steps.prepare.outputs.version }}  | 
 | 88 | +            ghcr.io/${GITHUB_REPOSITORY,,}/ps3dev:${{ steps.prepare.outputs.version }}  | 
 | 89 | +          cache-from: type=local,src=/tmp/.buildx-cache  | 
 | 90 | +          cache-to: type=local,dest=/tmp/.buildx-cache-new  | 
 | 91 | +      - name: Move cache  | 
 | 92 | +        # Temp fix  | 
 | 93 | +        # https://github.com/docker/build-push-action/issues/252  | 
 | 94 | +        # https://github.com/moby/buildkit/issues/1896  | 
 | 95 | +        run: |  | 
 | 96 | +          rm -rf /tmp/.buildx-cache  | 
 | 97 | +          mv /tmp/.buildx-cache-new /tmp/.buildx-cache  | 
0 commit comments