Skip to content

Commit 78c88d3

Browse files
committed
chore: Fixed workflows as part of an adoption process
1 parent 89700ad commit 78c88d3

File tree

3 files changed

+126
-64
lines changed

3 files changed

+126
-64
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build Container Image
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
# Publish semver tags as releases.
12+
tags: [ '*.*.*' ]
13+
pull_request:
14+
branches: [ "main" ]
15+
16+
env:
17+
# Use docker.io for Docker Hub if empty
18+
REGISTRY: ghcr.io
19+
# github.repository as <account>/<repo>
20+
IMAGE_NAME: ${{ github.repository }}
21+
22+
23+
jobs:
24+
build:
25+
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
# This is used to complete the identity challenge
31+
# with sigstore/fulcio when running outside of PRs.
32+
id-token: write
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
38+
# Install the cosign tool except on PR
39+
# https://github.com/sigstore/cosign-installer
40+
- name: Install cosign
41+
if: github.event_name != 'pull_request'
42+
uses: sigstore/[email protected]
43+
with:
44+
cosign-release: 'v2.2.3'
45+
46+
# Set up QEMU to be able to build to multiple architectures
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v1
49+
50+
# Workaround: https://github.com/docker/build-push-action/issues/461
51+
- name: Setup Docker buildx
52+
uses: docker/[email protected]
53+
54+
# Login against a Docker registry except on PR
55+
# https://github.com/docker/login-action
56+
- name: Log into registry ${{ env.REGISTRY }}
57+
if: github.event_name != 'pull_request'
58+
uses: docker/[email protected]
59+
with:
60+
registry: ${{ env.REGISTRY }}
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
64+
# Extract metadata (tags, labels) for Docker
65+
# https://github.com/docker/metadata-action
66+
- name: Extract Docker metadata
67+
id: meta
68+
uses: docker/[email protected]
69+
with:
70+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
71+
72+
# Build and push Docker image with Buildx (don't push on PR)
73+
# https://github.com/docker/build-push-action
74+
- name: Build and push Docker image
75+
id: build-and-push
76+
uses: docker/[email protected]
77+
with:
78+
context: .
79+
push: ${{ github.event_name != 'pull_request' }}
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
82+
platforms: linux/amd64,linux/arm64
83+
84+
85+
# Sign the resulting Docker image digest except on PRs.
86+
# This will only write to the public Rekor transparency log when the Docker
87+
# repository is public to avoid leaking data. If you would like to publish
88+
# transparency data even for private images, pass --force to cosign below.
89+
# https://github.com/sigstore/cosign
90+
- name: Sign the published Docker image
91+
if: ${{ github.event_name != 'pull_request' }}
92+
env:
93+
COSIGN_EXPERIMENTAL: "true"
94+
# This step uses the identity token to provision an ephemeral certificate
95+
# against the sigstore community Fulcio instance.
96+
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}

.github/workflows/docker-push.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/python-package.yml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,33 @@ jobs:
5454
export COMMIT_MESSAGE=$(git log -1)
5555
ruby validate-signature.rb "${COMMIT_MESSAGE}"
5656
57-
deploy:
58-
strategy:
59-
matrix:
60-
python-version: [3.7]
61-
62-
runs-on: ubuntu-latest
63-
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
64-
65-
steps:
66-
- uses: actions/checkout@v2
67-
with:
68-
token: ${{ secrets.GH_TOKEN }}
69-
fetch-depth: 0
70-
- name: Set up Python ${{ matrix.python-version }}
71-
uses: actions/setup-python@v2
72-
with:
73-
python-version: ${{ matrix.python-version }}
74-
- name: install semantic-release
75-
run: |
76-
pip install python-semantic-release
77-
- name: deploy pip
78-
run: |
79-
git config --global user.name "semantic-release (via github actions)"
80-
git config --global user.email "semantic-release@github-actions"
81-
semantic-release publish
82-
env: # Or as an environment variable
83-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
84-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
57+
# Deactivated pypi publishing until adoption process is done
58+
#
59+
# deploy:
60+
# strategy:
61+
# matrix:
62+
# python-version: [3.7]
63+
#
64+
# runs-on: ubuntu-latest
65+
# if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
66+
#
67+
# steps:
68+
# - uses: actions/checkout@v2
69+
# with:
70+
# token: ${{ secrets.GH_TOKEN }}
71+
# fetch-depth: 0
72+
# - name: Set up Python ${{ matrix.python-version }}
73+
# uses: actions/setup-python@v2
74+
# with:
75+
# python-version: ${{ matrix.python-version }}
76+
# - name: install semantic-release
77+
# run: |
78+
# pip install python-semantic-release
79+
# - name: deploy pip
80+
# run: |
81+
# git config --global user.name "semantic-release (via github actions)"
82+
# git config --global user.email "semantic-release@github-actions"
83+
# semantic-release publish
84+
# env: # Or as an environment variable
85+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
86+
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)