working on actions

This commit is contained in:
Corban-Lee Jones 2024-08-05 19:59:28 +01:00
parent 1dc4e3f6df
commit fbe726f394
3 changed files with 19 additions and 49 deletions

View File

@ -0,0 +1,19 @@
name: Build and Push Docker Image
run-name: ${{ gitea.actor }} is building and pushing a Docker Image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Build Docker image
run: |
docker build -t pyrss-website:latest .
- name: Push Docker image
run: |
docker tag pyrss-website:latest xordk/pyrss-website:latest
docker push xordk/pyrss-website:latest
with:
username: ${{ secrets.DOCKER_PASSWORD }}
password: ${{ secrets.DOCKER_USERNAME }}

View File

@ -1,49 +0,0 @@
name: Build and Push Docker Image
run-name: ${{ gitea.actor }} is building and pushing a Docker Image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Set up git user
run: |
git config --global user.email "${{ secrets.GIT_EMAIL }}"
git config --global user.name "${{ secrets.GIT_USERNAME }}"
- name: Bump version
id: bump_version
run: |
bump2version patch
NEW_VERSION=$(git describe --tags)
echo ${NEW_VERSION}
echo "NEW_VERSION=${NEW_VERSION}" > new_version.txt
- name: Build Docker image
run: |
NEW_VERSION=$(cat new_version.txt)
docker build -t pyrss-website:${{ NEW_VERSION }} .
- name: Push Docker image
run: |
NEW_VERSION=$(cat new_version.txt)
docker tag pyrss-website:${{ NEW_VERSION }} xordk/pyrss-website:${{ NEW_VERSION }}
docker push xordk/pyrss-website:${{ NEW_VERSION }}
rm new_version.txt
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}