Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/scripts/deploy-appstarter
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

## Deploy codeigniter4/appstarter

# Setup variables
SOURCE=$1
TARGET=$2
RELEASE=$3

echo "Preparing for version $3"
echo "Merging files from $1 to $2"

# Prepare the source
cd $SOURCE
git checkout master

# Prepare the target
cd $TARGET
git checkout master
rm -rf *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command scares me :) Can you explain it is doing. Seems like you checkout master branch then delete everything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the old script worked it would copy in the chosen files (like we do below) pre-wiping any directories (this was the bugged part from the cprm typo). Where that fails is when there are files that are renamed or removed (notice we have license.txt and a duplicate legacy LICENSE because of this). Using the modified version above it checks out the target repo (AppStarter or framework) and rebuilds the repo from scratch (* ignores files with leading periods so it doesn’t affect the .git directory). Also, it’s just a new commit so we could always back up one and nothing is lost!


# Copy common files
releasable='app public writable env license.txt spark .gitignore'
for fff in $releasable ; do
cp -Rf ${SOURCE}/$fff ./
done

# Copy repo-specific files
cp -Rf ${SOURCE}/admin/starter/. ./

# Commit the changes
git add .
git commit -m "Release ${RELEASE}"
git push
34 changes: 34 additions & 0 deletions .github/scripts/deploy-framework
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

## Deploy codeigniter4/framework

# Setup variables
SOURCE=$1
TARGET=$2
RELEASE=$3

echo "Preparing for version $3"
echo "Merging files from $1 to $2"

# Prepare the source
cd $SOURCE
git checkout master

# Prepare the target
cd $TARGET
git checkout master
rm -rf *

# Copy common files
releasable='app public writable env license.txt spark .gitignore system'
for fff in $releasable ; do
cp -Rf ${SOURCE}/$fff ./
done

# Copy repo-specific files
cp -Rf ${SOURCE}/admin/framework/. ./

# Commit the changes
git add .
git commit -m "Release ${RELEASE}"
git push
94 changes: 94 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Deploy

on:
release:
types: [published]

jobs:
framework:
runs-on: ubuntu-latest

steps:
- name: Identify
run: |
git config --global user.email "action@github.com"
git config --global user.name "${GITHUB_ACTOR}"

- name: Checkout source
uses: actions/checkout@v2
with:
path: source

- name: Checkout target
uses: actions/checkout@v2
with:
repository: codeigniter4/framework
token: ${{ secrets.ACCESS_TOKEN }}
path: framework

- name: Chmod
run: chmod +x ./source/.github/scripts/deploy-framework

- name: Deploy
run: ./source/.github/scripts/deploy-framework ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/framework ${GITHUB_REF##*/}

- name: Release
uses: actions/github-script@0.8.0
with:
github-token: ${{secrets.ACCESS_TOKEN}}
script: |
const release = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
github.repos.createRelease({
owner: context.repo.owner,
repo: 'framework',
tag_name: release.data.tag_name,
name: release.data.name,
body: release.data.body
})

appstarter:
runs-on: ubuntu-latest

steps:
- name: Identify
run: |
git config --global user.email "action@github.com"
git config --global user.name "${GITHUB_ACTOR}"

- name: Checkout source
uses: actions/checkout@v2
with:
path: source

- name: Checkout target
uses: actions/checkout@v2
with:
repository: codeigniter4/appstarter
token: ${{ secrets.ACCESS_TOKEN }}
path: appstarter

- name: Chmod
run: chmod +x ./source/.github/scripts/deploy-appstarter

- name: Deploy
run: ./source/.github/scripts/deploy-appstarter ${GITHUB_WORKSPACE}/source ${GITHUB_WORKSPACE}/appstarter ${GITHUB_REF##*/}

- name: Release
uses: actions/github-script@0.8.0
with:
github-token: ${{secrets.ACCESS_TOKEN}}
script: |
const release = await github.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo
})
github.repos.createRelease({
owner: context.repo.owner,
repo: 'appstarter',
tag_name: release.data.tag_name,
name: release.data.name,
body: release.data.body
})
8 changes: 2 additions & 6 deletions admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This folder contains tools or docs useful for project maintainers.
It is meant to be downloaded by developers, or composer-installed.
This is a read-only repository.
- **appstarter** is the released application starter repository.
It is derived from the framework's `application` and `public` folders, with
It is derived from the framework's `app` and `public` folders, with
a composer requirement dependency to pull in the framework itself.
It is meant to be downloaded or composer-installed.
This is a read-only repository.
Expand Down Expand Up @@ -64,14 +64,10 @@ scripts used by the release manager:
in it, and it will run the related scripts following, to revise
the release distributions.
Usage: `admin/release version qualifier`
- **release-framework** builds the distributable framework repo.
It could be used on its own, but is normally part of `release`.
- **release-appstarter** builds the distributable appstarter repo.
It could be used on its own, but is normally part of `release`.
- **release-userguide** builds the distributable userguide repo.
It could be used on its own, but is normally part of `release`.
- **release-deploy** pushes the release changes to the appropriate github
repositories. Tag & create releases on github. This is not easily reversible!
repositories. Tag & create releases on GitHub. This is not easily reversible!
Usage: `admin/release-deploy version qualifier`
- **release-revert** can be used to restore your repositories to the state they
were in before you started a release. **IF** you haven't deployed.
Expand Down
4 changes: 0 additions & 4 deletions admin/release
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ if [ -d dist ]; then
fi
mkdir dist

setup_repo framework
setup_repo userguide
setup_repo appstarter

#---------------------------------------------------
# Housekeeping - make sure writable is flushed of test files
Expand Down Expand Up @@ -139,9 +137,7 @@ git commit -S -m "Release ${RELEASE}"
#---------------------------------------------------
# Build the distributables

. admin/release-framework
. admin/release-userguide
. admin/release-appstarter

#---------------------------------------------------
# Done for now
Expand Down
42 changes: 0 additions & 42 deletions admin/release-appstarter

This file was deleted.

8 changes: 0 additions & 8 deletions admin/release-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ echo -e "${BOLD}Pushing to the user guide repository${NORMAL}"
cd ${CI_DIR}/dist/userguide
git push origin master

echo -e "${BOLD}Pushing to the framework repository${NORMAL}"
cd ${CI_DIR}/dist/framework
git push origin master

echo -e "${BOLD}Pushing to the app starter repository${NORMAL}"
cd ${CI_DIR}/dist/appstarter
git push origin master

cd ${CI_DIR}

#---------------------------------------------------
Expand Down
42 changes: 0 additions & 42 deletions admin/release-framework

This file was deleted.

Loading