Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push container images to GitHub instead of Google Container Registry #995

Merged
merged 4 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/container-image-squid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Build and push the Squid container image"

on:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/squid/docker/**'

jobs:
build-push-squid-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: squid
docker_context: modules/cloud-config-container/squid/docker
29 changes: 29 additions & 0 deletions .github/workflows/container-image-strongswan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Build and push the strongSwan container image"

on:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/onprem/docker-images/strongswan/**'

jobs:
build-push-strongswan-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: strongswan
docker_context: modules/cloud-config-container/onprem/docker-images/strongswan
29 changes: 29 additions & 0 deletions .github/workflows/container-image-toolbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Build and push the Toolbox container image"

on:
push:
branches:
- master
paths:
- 'modules/cloud-config-container/onprem/docker-images/toolbox/**'

jobs:
build-push-toolbox-container-image:
uses: ./.github/workflows/container-image.yml
with:
image_name: toolbox
docker_context: modules/cloud-config-container/onprem/docker-images/toolbox
51 changes: 51 additions & 0 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: "Build and push a generic container image"

on:
workflow_call:
inputs:
image_name:
required: true
type: string
docker_context:
required: true
type: string

jobs:
build-push-generic-container-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ${{ inputs.docker_context }}
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:latest
ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ steps.date.outputs.date }}