Skip to content

Commit 1ec60b7

Browse files
chore: add docker release workflow
1 parent 997a244 commit 1ec60b7

File tree

2 files changed

+67
-18
lines changed

2 files changed

+67
-18
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Release
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
push_to_registry:
8+
name: Push Docker image to GitHub Packages
9+
runs-on: ubuntu-latest
10+
permissions:
11+
packages: write
12+
contents: read
13+
strategy:
14+
matrix:
15+
app:
16+
- ical-simplejson-proxy
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v3
20+
- name: Docker meta
21+
id: meta
22+
uses: docker/metadata-action@v3
23+
with:
24+
# list of Docker images to use as base name for tags
25+
images: |
26+
ghcr.io/${{ github.repository_owner }}/${{ matrix.app }}
27+
# generate Docker tags based on the following events/attributes
28+
tags: |
29+
type=schedule
30+
type=ref,event=branch
31+
type=ref,event=pr
32+
type=semver,pattern={{version}}
33+
type=semver,pattern={{major}}.{{minor}}
34+
type=semver,pattern={{major}}
35+
type=sha
36+
- name: Log in to GitHub Container Registry
37+
uses: docker/login-action@v1
38+
if: github.event_name != 'pull_request'
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Build and push
44+
uses: docker/build-push-action@v2
45+
with:
46+
context: ${{ matrix.app }}
47+
push: ${{ github.event_name != 'pull_request' }}
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/test-and-lint.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ name: Test and Lint
22
on:
33
push:
44
branches:
5-
- main
5+
- main
66
pull_request:
77
branches:
8-
- main
8+
- main
99
schedule:
10-
- cron: '30 11 * * *'
10+
- cron: '30 11 * * *'
1111
jobs:
1212
test:
1313
runs-on: ubuntu-latest
@@ -21,18 +21,18 @@ jobs:
2121
- '3.9'
2222
- '3.10'
2323
steps:
24-
- uses: actions/checkout@v3
25-
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v4
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
- name: Install dependencies
30-
run: |
31-
cd ${{ matrix.app }}
32-
python -m pip install --upgrade pip
33-
pip install -r requirements.txt
34-
pip install tox tox-gh-actions
35-
- name: Test with Tox
36-
run: |
37-
cd ${{ matrix.app }}
38-
tox
24+
- uses: actions/checkout@v3
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
cd ${{ matrix.app }}
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
pip install tox tox-gh-actions
35+
- name: Test with Tox
36+
run: |
37+
cd ${{ matrix.app }}
38+
tox

0 commit comments

Comments
 (0)