Skip to content

Commit

Permalink
Merge branch 'master' into Dot-files
Browse files Browse the repository at this point in the history
  • Loading branch information
craigk5n authored Sep 12, 2023
2 parents 6884283 + 8a5cfcd commit 4d0d0de
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 47 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Docker image

on:
push:
branches: [ master ]
branches: [ release ]
release:
types: [ published ]

Expand All @@ -14,22 +14,23 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Extract WebCalendar Version
id: extract_version
run: echo "::set-output name=version::$(./bump_version.sh -p)"

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Extract metadata (like version) from the repository
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile-php8
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:v1.9.8-dev-php8
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:${{ steps.extract_version.outputs.version }}-php8-apache
${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:latest-php8-apache
${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:latest
74 changes: 74 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Create Release

on:
push:
branches:
- release

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get release version
run: echo "RELEASE_VERSION=$(./bump_version.sh -p)" >> $GITHUB_ENV

- name: Create release directory
run: mkdir release-dir

- name: Copy files to release directory
run: |
while IFS= read -r file; do
echo "Copying $file"
mkdir -p WebCalendar-1.9.8/$(dirname "$file")
cp "$file" WebCalendar-1.9.8/"$file"
done < release-files
- name: Zip the release
run: zip -r WebCalendar-${{ env.RELEASE_VERSION }}.zip WebCalendar-${{ env.RELEASE_VERSION }}/

- name: Check and Delete Existing Tag
run: |
# Check if the tag exists
if git rev-parse "v${{ env.RELEASE_VERSION }}" >/dev/null 2>&1; then
echo "Tag exists, deleting..."
git tag -d "v${{ env.RELEASE_VERSION }}"
git push --delete origin "v${{ env.RELEASE_VERSION }}"
fi
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_VERSION }}
release_name: WebCalendar v${{ env.RELEASE_VERSION }}
body: Release of WebCalendar v${{ env.RELEASE_VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./WebCalendar-${{ env.RELEASE_VERSION }}.zip
asset_name: WebCalendar-${{ env.RELEASE_VERSION }}.zip
asset_content_type: application/zip

- name: Tag the Release Branch
run: |
# Check if the tag exists
if git rev-parse "v${{ env.RELEASE_VERSION }}" >/dev/null 2>&1; then
echo "Tag exists, deleting..."
git tag -d "v${{ env.RELEASE_VERSION }}"
git push --delete origin "v${{ env.RELEASE_VERSION }}"
fi
# Create and push the tag
git tag v${{ env.RELEASE_VERSION }}
git push origin v${{ env.RELEASE_VERSION }}
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
*.class
.DS_Store
.htaccess
*.jar
*.min.*
*.orig
*.save
*.sha
includes/htmlare*
includes/settings.php
*.jar
*.jar
java/
*.log
mysql-data
node_modules/
*.old
*.orig
pub/
__pycache__
*.save
*.sha
tests/.phpunit.result.cache
vendor/
wc-icons/
wc-icons/
17 changes: 0 additions & 17 deletions bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@ update_config_php() {



# Function to update version in .github/workflows/docker.yml
update_docker_yml() {
local file_path=".github/workflows/docker.yml"
local new_version="$1"

# Get the line number containing the version tag
local line_num=$(grep -nE 'tags: \${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar:[^ ]*-dev-php8' "$file_path" | cut -d: -f1)

# If we found the line, update the version on that line
if [[ -n "$line_num" ]]; then
sed -i "${line_num}s|webcalendar:[^ ]*-dev-php8|webcalendar:${new_version}-dev-php8|" "$file_path"
fi

echo "Updated $file_path to version $new_version"
}

# Function to update version in UPGRADING.html
update_upgrading_html() {
local file_path="UPGRADING.html"
Expand Down Expand Up @@ -152,7 +136,6 @@ for file in "${sql_files[@]}"; do
done

update_config_php "$new_version"
update_docker_yml "$new_version"
update_upgrading_html "$new_version"
update_composer_json "$new_version"
update_upgrade_matrix "$new_version"
Expand Down
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions release-files
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ includes/css/access.css
includes/css/docs.css
includes/css/print_styles.css
includes/css/punctuation.css
includes/css/rss-style.css
includes/css/styles.css
includes/css/styles.php
includes/date_formats.php
Expand Down Expand Up @@ -159,7 +160,6 @@ includes/site_extras.php
includes/trailer.php
includes/translate.php
includes/user-app-joomla.php
includes/user-app-postnuke.php
includes/user-imap.php
includes/user-ldap.php
includes/user-nis.php
Expand Down Expand Up @@ -328,7 +328,6 @@ report.php
resourcecal_mgmt.php
rss_activity_log.php
rss.php
rss-style.css
rss_unapproved.php
search_handler.php
search.php
Expand Down

0 comments on commit 4d0d0de

Please sign in to comment.