forked from openthread/ot-efr32
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! (wip)[actions] trigger build workflow after docker workflow
- Loading branch information
Showing
3 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
name: Docker | ||
|
||
env: | ||
SHA_TAG: siliconlabsinc/ot-efr32-dev:${{ github.sha }} | ||
SHA_TAG: ghcr.io/siliconlabsinc/ot-efr32-dev:${{ github.sha }} | ||
LATEST_TAG: siliconlabsinc/ot-efr32-dev:latest | ||
DOCKER_IMAGE_ARTIFACT_NAME: ot-efr32-dev-image-${{ github.sha }}-${{ github.event_name}}.tar | ||
|
||
|
@@ -70,6 +70,8 @@ jobs: | |
- name: Build and export to Docker context | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
context: . | ||
file: docker/Dockerfile | ||
load: true | ||
|
@@ -122,15 +124,45 @@ jobs: | |
name: ${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
path: /tmp/${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
|
||
publish: | ||
name: Publish to DockerHub | ||
publish-ghcr: | ||
name: Publish to GitHub Container Registry | ||
runs-on: ubuntu-22.04 | ||
needs: [build] | ||
steps: | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Download Docker image | ||
id: download | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
path: /tmp | ||
|
||
- name: Load Docker image | ||
run: | | ||
docker load --input ${{ steps.download.outputs.download-path }}/${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
docker inspect ${{ env.SHA_TAG }} | ||
- name: Push Docker image | ||
run: | | ||
docker push ${{ env.SHA_TAG }} | ||
publish-dockerhub: | ||
name: Tag `latest` and publish to DockerHub | ||
runs-on: ubuntu-22.04 | ||
needs: [build] | ||
if: | | ||
github.repository == 'SiliconLabs/ot-efr32' && | ||
github.event_name != 'pull_request' | ||
github.event_name != 'pull_request' && | ||
github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Login to DockerHub | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
|
@@ -146,14 +178,14 @@ jobs: | |
- name: Load Docker image | ||
run: | | ||
docker load --input ${{ steps.download.outputs.download-path }}/${{ env.DOCKER_IMAGE_ARTIFACT_NAME }} | ||
docker image ls -a | ||
- name: Push Docker image | ||
run: | | ||
docker push ${{ env.SHA_TAG }} | ||
docker inspect ${{ env.SHA_TAG }} | ||
- name: Tag `latest` and push | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
docker tag ${{ env.SHA_TAG }} ${{ env.LATEST_TAG }} | ||
docker push ${{ env.LATEST_TAG }} | ||
trigger_build: | ||
name: Trigger Build Workflow | ||
uses: ./.github/workflows/build.yml | ||
needs: [publish-ghcr] |
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