Updated build instructions for RedHat based systems (#117) #128
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: Build toolchain docker image | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
Docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
persist-credentials: false | |
- name: Set up Docker Buildx | |
if: success() | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v3 | |
with: | |
buildx-version: latest | |
qemu-version: latest | |
- name: Prepare | |
if: success() | |
id: prepare | |
run: | | |
echo ::set-output name=docker_platforms::linux/amd64,linux/386 | |
echo ::set-output name=docker_username::miigotu | |
echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3dev | |
VERSION_TAG=${GITHUB_REF#refs/*/} | |
echo ::set-output name=version::${VERSION_TAG%/merge} | |
- name: Available platforms | |
if: success() | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Docker Login and set build command | |
if: success() | |
id: login | |
env: | |
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "${GITHUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin docker.pkg.github.com | |
echo ::set-output name=buildx::$(echo docker buildx build --output type=image,name=${{ steps.prepare.outputs.github_image }},push=true \ | |
--platform ${{ steps.prepare.outputs.docker_platforms }} --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" \ | |
--tag "${{ steps.prepare.outputs.github_image }}:${{ steps.prepare.outputs.version }}") | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ steps.prepare.outputs.version }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Run Buildx (master) | |
if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request' | |
run: | | |
${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.github_image }}:latest" --file Dockerfile . | |
- name: Run Buildx (non-master) | |
if: success() && steps.prepare.outputs.version != 'master' && github.event_name != 'pull_request' | |
run: | | |
${{ steps.login.outputs.buildx }} --file Dockerfile . | |
- name: Clear | |
if: always() | |
run: | | |
rm -rf ${HOME}/.docker/config.json |