Skip to content

Commit

Permalink
Use step outputs instead of env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
myoung34 committed Nov 2, 2020
1 parent 76b0b01 commit d72e997
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 25 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -31,7 +33,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner-base:latest
tags: ${{ steps.org.outputs.ORG }}/github-runner-base:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.base

Expand All @@ -41,7 +43,9 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -60,7 +64,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner-base:ubuntu-bionic
tags: ${{ steps.org.outputs.ORG }}/github-runner-base:ubuntu-bionic
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.base.ubuntu-bionic

Expand All @@ -70,7 +74,9 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -89,6 +95,6 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner-base:ubuntu-xenial
tags: ${{ steps.org.outputs.ORG }}/github-runner-base:ubuntu-xenial
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.base.ubuntu-xenial
22 changes: 14 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -32,7 +34,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:latest
tags: ${{ steps.org.outputs.ORG }}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile

Expand All @@ -42,7 +44,9 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -54,12 +58,12 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${{ORG}}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${{ steps.org.outputs.ORG }}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:latest
tags: ${{ steps.org.outputs.ORG }}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-bionic

Expand All @@ -69,7 +73,9 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -81,11 +87,11 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${{ORG}}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${{ steps.org.outputs.ORG }}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:latest
tags: ${{ steps.org.outputs.ORG }}/github-runner:latest
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-xenial
34 changes: 23 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
id: tag
shell: bash
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -46,7 +50,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:${TAG}
tags: ${{ steps.org.outputs.ORG }}/github-runner:${{ step.tag.outputs.TAG }}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile

Expand All @@ -57,9 +61,13 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
id: tag
shell: bash
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -71,12 +79,12 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${{ORG}}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${{ steps.org.outputs.ORG }}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:${TAG}
tags: ${{ steps.org.outputs.ORG }}/github-runner:${{ step.tag.outputs.TAG }}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-bionic

Expand All @@ -87,9 +95,13 @@ jobs:
- name: Checkout
uses: actions/checkout@master
- name: get version
run: echo ::set-env name=TAG::${GITHUB_REF#refs/tags/}
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/}
id: tag
shell: bash
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
run: echo ::set-output name=ORG::$(dirname ${GITHUB_REPOSITORY})
id: org
shell: bash
- name: Set up Docker
uses: docker/setup-buildx-action@v1
with:
Expand All @@ -101,11 +113,11 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${{ORG}}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${{ steps.org.outputs.ORG }}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ORG}}/github-runner:${TAG}
tags: ${{ steps.org.outputs.ORG }}/github-runner:${{ step.tag.outputs.TAG }}
platforms: linux/amd64,linux/arm64,linux/386
file: ./Dockerfile.ubuntu-xenial

0 comments on commit d72e997

Please sign in to comment.