Compare commits
11 Commits
689dd5e58e
...
17618483c0
Author | SHA1 | Date | |
---|---|---|---|
17618483c0 | |||
fb35156a28 | |||
d3fab75acb | |||
b69609551f | |||
d616711cf5 | |||
2a7df3d413 | |||
edff65d35d | |||
d006ebf9fc | |||
0389ad841b | |||
c946991eb2 | |||
e1bc246e10 |
@ -1,4 +1,4 @@
|
|||||||
name: CI w/ Poetry and Docker
|
name: CI
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
@ -6,7 +6,8 @@ on:
|
|||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_manual_trigger:
|
manual_trigger:
|
||||||
|
name: Manual Trigger Cleanup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ gitea.event_name == 'issue_comment' }}
|
if: ${{ gitea.event_name == 'issue_comment' }}
|
||||||
steps:
|
steps:
|
||||||
@ -22,23 +23,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Delete issue comment
|
- name: Delete issue comment
|
||||||
run: |
|
run: |
|
||||||
curl -X DELETE -H "Authorization: token ${{ gitea.token }}" "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/issues/comments/${{ gitea.event.comment.id }}"
|
curl -X DELETE \
|
||||||
|
-H "Authorization: token ${{ gitea.token }}" \
|
||||||
# get_last_tag:
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/issues/comments/${{ gitea.event.comment.id }}"
|
||||||
# name: Get last tag
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# needs: check_manual_trigger
|
|
||||||
# outputs:
|
|
||||||
# last_tag: ${{ steps.last_tag.outputs.last_tag }}
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v4.2.2
|
|
||||||
# with:
|
|
||||||
# fetch-depth: 0
|
|
||||||
# - name: Get last tag
|
|
||||||
# id: last_tag
|
|
||||||
# run: |
|
|
||||||
# LASTTAG=$(git describe --tags --abbrev=0)
|
|
||||||
# echo "last_tag=$LASTTAG" >> "$GITEA_OUTPUT"
|
|
||||||
|
|
||||||
# test:
|
# test:
|
||||||
# name: Unit Test
|
# name: Unit Test
|
||||||
@ -49,29 +36,21 @@ jobs:
|
|||||||
name: Create Release
|
name: Create Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: test
|
# needs: test
|
||||||
# needs: get_last_tag
|
|
||||||
outputs:
|
outputs:
|
||||||
release_name: ${{ steps.tag_version.outputs.new_tag }}
|
release_name: ${{ steps.get_next_version.outputs.tag }}
|
||||||
success: ${{ steps.set_flag.outputs.success }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Changes since last tag
|
- name: Changes since last tag
|
||||||
id: changes
|
id: changes
|
||||||
run: |
|
run: |
|
||||||
rm -f .changes .changes_feat .changes_fix .changes_dep .changes_other
|
rm -f .changes
|
||||||
git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes
|
git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline >> .changes
|
||||||
cat .changes
|
cat .changes
|
||||||
|
|
||||||
- name: Upload changelog file
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: changelog-file
|
|
||||||
path: ./.changes
|
|
||||||
include-hidden-files: true
|
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
run: |
|
run: |
|
||||||
if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then
|
if [[ -z $(grep '[^[:space:]]' .changes) ]] ; then
|
||||||
@ -80,38 +59,12 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "changes=true"
|
echo "changes=true"
|
||||||
echo "changes=true" >> "$GITEA_OUTPUT"
|
echo "changes=true" >> "$GITEA_OUTPUT"
|
||||||
grep -i "feat" .changes >> .changes_feat || true
|
|
||||||
grep -i "fix" .changes >> .changes_fix || true
|
|
||||||
grep -i "dependencies" .changes >> .changes_dep || true
|
|
||||||
grep -i "other" .changes >> .changes_other || true
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Cancel if no changes
|
- name: Cancel if no changes
|
||||||
if: steps.changes.outputs.changes == 'false'
|
if: steps.changes.outputs.changes == 'false'
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|
||||||
# - name: Create changelog
|
|
||||||
# id: create_changelog
|
|
||||||
# if: steps.changes.outputs.changes == true
|
|
||||||
# run: |
|
|
||||||
# rm -f .changelog
|
|
||||||
# if [[ -z $(grep '[^[:space:]]' .changes_feat) ]] ; then
|
|
||||||
# printf "## 🚀 Features" > .changelog
|
|
||||||
# cat .changes_feat >> .changelog
|
|
||||||
# fi
|
|
||||||
# if [[ -z $(grep '[^[:space:]]' .changes_fix) ]] ; then
|
|
||||||
# printf "## 🐛 Bug Fixes" >> .changelog
|
|
||||||
# cat .changes_fix >> .changelog
|
|
||||||
# fi
|
|
||||||
# if [[ -z $(grep '[^[:space:]]' .changes_dep) ]] ; then
|
|
||||||
# printf "## 📦 Dependencies" >> .changelog
|
|
||||||
# cat .changes_dep >> .changelog
|
|
||||||
# fi
|
|
||||||
# if [[ -z $(grep '[^[:space:]]' .changes_other) ]] ; then
|
|
||||||
# printf "## 💬 Other" >> .changelog
|
|
||||||
# cat .changes_other >> .changelog
|
|
||||||
# fi
|
|
||||||
|
|
||||||
- name: Set server URL
|
- name: Set server URL
|
||||||
id: set_srvurl
|
id: set_srvurl
|
||||||
run: |
|
run: |
|
||||||
@ -134,93 +87,32 @@ jobs:
|
|||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
run: |
|
run: |
|
||||||
curl -X POST \
|
curl -s -X POST \
|
||||||
-H "Authorization: token ${{ secrets.ACTIONS_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.ACTIONS_TOKEN }}" \
|
||||||
-H "accept: application/json" \
|
-H "accept: application/json" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\": \"${{ steps.get_next_version.outputs.tag }}\", \"name\": \"${{ steps.get_next_version.outputs.tag }}\", \"body\": \"${{ steps.get_next_version.outputs.changelog }}\"}" \
|
-d "{\"tag_name\": \"${{ steps.get_next_version.outputs.tag }}\", \"name\": \"${{ steps.get_next_version.outputs.tag }}\", \"body\": \"${{ steps.get_next_version.outputs.changelog }}\"}" \
|
||||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases"
|
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases"
|
||||||
|
|
||||||
# - name: Create release
|
build_docker:
|
||||||
# id: create_release
|
name: Build Docker Images
|
||||||
# uses: akkuman/gitea-release-action@v1
|
|
||||||
# env:
|
|
||||||
# NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18
|
|
||||||
# with:
|
|
||||||
# tag: ${{ steps.get_next_version.outputs.tag }}
|
|
||||||
# name: ${{ steps.get_next_version.outputs.tag }}
|
|
||||||
# # body_path: .changelog
|
|
||||||
# body: ${{ steps.get_next_version.outputs.changelog }}
|
|
||||||
|
|
||||||
- name: Set success/fail flag
|
|
||||||
id: set_flag
|
|
||||||
if: steps.changes.outputs.changes == 'true'
|
|
||||||
run: if test "${{ steps.changes.outputs.changes }}" = "true"; then echo "success=true" >> "$GITEA_OUTPUT"; else echo "success=false" >> "$GITEA_OUTPUT"; fi
|
|
||||||
|
|
||||||
build_docker_ghcr:
|
|
||||||
name: Build GHCR Docker Images
|
|
||||||
needs: create_release
|
needs: create_release
|
||||||
if: ${{ needs.create_release.outputs.success == 'true' }}
|
|
||||||
outputs:
|
|
||||||
success: ${{ steps.set_flag.outputs.success }}
|
|
||||||
with:
|
|
||||||
release: ${{ needs.create_release.outputs.release_name }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Update Docker configuration
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
mkdir -p /etc/default
|
||||||
|
mkdir -p /etc/docker
|
||||||
|
touch -a /etc/default/docker
|
||||||
|
touch -a /etc/docker/daemon.json
|
||||||
|
echo "DOCKER_OPTS=\"--insecure-registry ${{ vars.PACKAGES_REGISTRY_URL }}\"" >> /etc/default/docker
|
||||||
|
echo "{\"insecure-registries\": [\"${{ vars.PACKAGES_REGISTRY_URL }}\"]}" > /etc/docker/daemon.json
|
||||||
|
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ inputs.release }}
|
fetch-depth: 0
|
||||||
|
ref: ${{ needs.create_release.outputs.release_name }}
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: luketainton
|
|
||||||
password: ${{ secrets.GHCR_TOKEN }}
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ghcr.io/luketainton/webexmemebot
|
|
||||||
tags: type=semver,pattern=v{{version}},value=${{ inputs.release }}
|
|
||||||
|
|
||||||
- name: Build and push images
|
|
||||||
id: build_push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
tags: |
|
|
||||||
ghcr.io/luketainton/webexmemebot:latest
|
|
||||||
ghcr.io/luketainton/webexmemebot:${{ inputs.release }}
|
|
||||||
|
|
||||||
- name: Generate artifact attestation
|
|
||||||
uses: actions/attest-build-provenance@v2
|
|
||||||
with:
|
|
||||||
subject-name: ghcr.io/luketainton/webexmemebot
|
|
||||||
subject-digest: ${{ steps.build_push.outputs.digest }}
|
|
||||||
push-to-registry: true
|
|
||||||
|
|
||||||
- name: Set success flag
|
|
||||||
id: set_flag
|
|
||||||
run: echo "success=true" >> "$GITEA_OUTPUT"
|
|
||||||
|
|
||||||
build_docker_gitea:
|
|
||||||
name: Build Gitea Docker Images
|
|
||||||
needs: create_release
|
|
||||||
if: ${{ needs.create_release.outputs.success == 'true' }}
|
|
||||||
outputs:
|
|
||||||
success: ${{ steps.set_flag.outputs.success }}
|
|
||||||
with:
|
|
||||||
release: ${{ needs.create_release.outputs.release_name }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ inputs.release }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@ -229,23 +121,30 @@ jobs:
|
|||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.PACKAGES_REGISTRY_URL }}
|
registry: ${{ vars.PACKAGES_REGISTRY_URL }}
|
||||||
username: ${{ vars.PACKAGES_REGISTRY_USERNAME }}
|
username: ${{ vars.ACTIONS_USERNAME }}
|
||||||
password: ${{ vars.PACKAGES_REGISTRY_PASSWORD }}
|
password: ${{ secrets.ACTIONS_TOKEN }}
|
||||||
|
|
||||||
- name: Build Gitea image(s)
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ vars.GHCR_USERNAME }}
|
||||||
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ vars.GHCR_USERNAME }}/webexmemebot
|
||||||
|
${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }}
|
||||||
|
tags: type=semver,pattern=v{{version}},value=${{ needs.create_release.outputs.release_name }}
|
||||||
|
|
||||||
|
- name: Build and push images
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: false
|
push: true
|
||||||
|
annotations: ${{ steps.meta.outputs.annotations }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }}:latest
|
|
||||||
${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }}:${{ inputs.release }}
|
|
||||||
|
|
||||||
- name: Push Gitea image(s)
|
|
||||||
run:
|
|
||||||
docker push ${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }}:latest ${{ vars.PACKAGES_REGISTRY_URL }}/${{ gitea.repository }}:${{ inputs.release }}
|
|
||||||
|
|
||||||
- name: Set success flag
|
|
||||||
id: set_flag
|
|
||||||
run: echo "success=true" >> "$GITEA_OUTPUT"
|
|
||||||
|
8
poetry.lock
generated
8
poetry.lock
generated
@ -636,17 +636,17 @@ tests = ["coverage[toml] (==5.0.4)", "pytest (>=6.0.0,<7.0.0)"]
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pylint"
|
name = "pylint"
|
||||||
version = "3.3.2"
|
version = "3.3.3"
|
||||||
description = "python code static checker"
|
description = "python code static checker"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.9.0"
|
python-versions = ">=3.9.0"
|
||||||
files = [
|
files = [
|
||||||
{file = "pylint-3.3.2-py3-none-any.whl", hash = "sha256:77f068c287d49b8683cd7c6e624243c74f92890f767f106ffa1ddf3c0a54cb7a"},
|
{file = "pylint-3.3.3-py3-none-any.whl", hash = "sha256:26e271a2bc8bce0fc23833805a9076dd9b4d5194e2a02164942cb3cdc37b4183"},
|
||||||
{file = "pylint-3.3.2.tar.gz", hash = "sha256:9ec054ec992cd05ad30a6df1676229739a73f8feeabf3912c995d17601052b01"},
|
{file = "pylint-3.3.3.tar.gz", hash = "sha256:07c607523b17e6d16e2ae0d7ef59602e332caa762af64203c24b41c27139f36a"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
astroid = ">=3.3.5,<=3.4.0-dev0"
|
astroid = ">=3.3.8,<=3.4.0-dev0"
|
||||||
colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
|
colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
|
||||||
dill = [
|
dill = [
|
||||||
{version = ">=0.3.7", markers = "python_version >= \"3.12\""},
|
{version = ">=0.3.7", markers = "python_version >= \"3.12\""},
|
||||||
|
Loading…
Reference in New Issue
Block a user