Skip to content

Commit 287b1ea

Browse files
committed
update ci jobs to update docker images with coresponding tags
1 parent b3f4e55 commit 287b1ea

2 files changed

Lines changed: 60 additions & 5 deletions

File tree

.github/workflows/build-installer.yml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,72 @@ on:
44
types: [published]
55

66
jobs:
7+
update-docker-tags:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- name: Checkout release tag
13+
uses: actions/checkout@v4
14+
with:
15+
ref: ${{ github.event.release.tag_name }}
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "github-actions[bot]"
22+
git config user.email "github-actions[bot]@users.noreply.github.com"
23+
24+
- name: Extract release tag
25+
id: release_tag
26+
run: |
27+
TAG_NAME="${{ github.event.release.tag_name }}"
28+
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_OUTPUT
29+
echo "Release tag: ${TAG_NAME}"
30+
31+
- name: Update docker-compose.yml to use release tags
32+
run: |
33+
RELEASE_TAG="${{ steps.release_tag.outputs.TAG_NAME }}"
34+
# Update all :develop tags to the release tag
35+
sed -i.bak "s/:develop/:${RELEASE_TAG}/g" docker-compose.yml
36+
rm docker-compose.yml.bak
37+
echo "Updated docker-compose.yml with release tag: ${RELEASE_TAG}"
38+
# Show the changes
39+
git diff docker-compose.yml || true
40+
41+
- name: Commit and update release tag
42+
run: |
43+
RELEASE_TAG="${{ steps.release_tag.outputs.TAG_NAME }}"
44+
45+
git add docker-compose.yml
46+
if ! git diff --staged --quiet; then
47+
# Create a new commit with updated docker-compose.yml
48+
git commit -m "chore: update image tags to ${RELEASE_TAG} for release"
49+
50+
# Update the tag to point to the new commit
51+
git tag -f ${RELEASE_TAG}
52+
git push origin ${RELEASE_TAG} --force
53+
echo "Updated release tag ${RELEASE_TAG} with docker-compose.yml changes"
54+
else
55+
echo "No changes to commit (docker-compose.yml already has release tags)"
56+
fi
57+
758
build-installer-and-upload-installer:
59+
needs: [update-docker-tags]
860
runs-on: ubuntu-latest
961
steps:
1062

1163
- name: Checkout OpenELIS-Global2
12-
uses: actions/checkout@v2
64+
uses: actions/checkout@v4
1365
with:
66+
ref: ${{ github.event.release.tag_name }}
1467
repository: ${{github.repository}}
68+
fetch-depth: 0
69+
token: ${{ secrets.GITHUB_TOKEN }}
1570

1671
- name: Build installer
17-
run: ./build.sh ${{github.ref_name}} ${{github.ref_name}}
72+
run: ./build.sh ${{ github.event.release.tag_name }} ${{ github.event.release.tag_name }}
1873

1974
- name: check installer
2075
run: ls OEDockerInstaller

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ createLinuxInstaller() {
2727

2828
echo "creating installer for context ${context}"
2929
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage
30-
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/volumes
30+
mkdir -p ${INSTALLER_CREATION_DIR}/${installerName}/configs
3131
cp ./install/run.sh ${INSTALLER_CREATION_DIR}/${installerName}/run.sh
3232
cp ./install/upgrade.sh ${INSTALLER_CREATION_DIR}/${installerName}/upgrade.sh
3333
cp docker-compose.yml ${INSTALLER_CREATION_DIR}/${installerName}/docker-compose.yml
34-
sed -i "s/:latest/:${dockerVersion}/g" ${INSTALLER_CREATION_DIR}/${installerName}/docker-compose.yml
35-
cp -r volumes/* ${INSTALLER_CREATION_DIR}/${installerName}/volumes
34+
cp .env ${INSTALLER_CREATION_DIR}/${installerName}/.env
35+
cp -r configs/* ${INSTALLER_CREATION_DIR}/${installerName}/configs
3636
cp OpenELIS-Global_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/OpenELIS-Global_DockerImage.tar.gz
3737
cp Postgres_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/Postgres_DockerImage.tar.gz
3838
cp JPAServer_DockerImage.tar.gz ${INSTALLER_CREATION_DIR}/${installerName}/dockerImage/JPAServer_DockerImage.tar.gz

0 commit comments

Comments
 (0)