This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
Update .env #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish Customer-service | |
on: | |
push: | |
branches: [ dev ] | |
paths: | |
- '.env' | |
jobs: | |
PackageDeploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' # Adjust the version as needed | |
- name: Install dependencies | |
run: npm install | |
- name: Docker Setup BuildX | |
uses: docker/setup-buildx-action@v2 | |
- name: Load environment variables and set them | |
run: | | |
if [ -f .env ]; then | |
export $(cat .env | grep -v '^#' | xargs) | |
fi | |
echo "RELEASE=$RELEASE" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo "BUILD=$BUILD" >> $GITHUB_ENV | |
echo "FIX=$FIX" >> $GITHUB_ENV | |
- name: Set repo | |
run: | | |
LOWER_CASE_GITHUB_REPOSITORY=$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]') | |
echo "DOCKER_TAG_CUSTOM=ghcr.io/${LOWER_CASE_GITHUB_REPOSITORY}:$RELEASE-$VERSION.$BUILD.$FIX" >> $GITHUB_ENV | |
echo "$GITHUB_ENV" | |
- name: Docker Build | |
run: docker image build -f Dockerfile.dev --tag $DOCKER_TAG_CUSTOM . | |
- name: Log in to GitHub container registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Push Docker image to ghcr | |
run: docker push $DOCKER_TAG_CUSTOM | |
- name: Check if image_update.md exists | |
id: check_file | |
run: | | |
if [ -f image_update.md ]; then | |
echo "::set-output name=file_exists::true" | |
else | |
echo "::set-output name=file_exists::false" | |
fi | |
- name: Generate image_update.md | |
run: | | |
if [ "${{ steps.check_file.outputs.file_exists }}" = "false" ]; then | |
echo "## Docker Image Update" >> image_update.md | |
echo "" >> image_update.md | |
echo "The Docker image has been successfully built and pushed." >> image_update.md | |
echo "" >> image_update.md | |
echo "You can pull the updated image using the following command:" >> image_update.md | |
echo "" >> image_update.md | |
# echo "```" >> image_update.md | |
echo "<code>docker pull $DOCKER_TAG_CUSTOM</code>" >> image_update.md | |
# echo "```" >> image_update.md | |
echo "" >> image_update.md | |
echo "Enjoy the Ruuter!" >> image_update.md | |
else | |
> image_update.md | |
echo "## Docker Image Update" >> image_update.md | |
echo "" >> image_update.md | |
echo "The Docker image has been successfully built and pushed." >> image_update.md | |
echo "" >> image_update.md | |
echo "You can pull the updated image using the following command:" >> image_update.md | |
echo "" >> image_update.md | |
# echo "```" >> image_update.md | |
echo "<code>docker pull $DOCKER_TAG_CUSTOM</code>" >> image_update.md | |
# echo "```" >> image_update.md | |
echo "" >> image_update.md | |
echo "Enjoy the Ruuter!" >> image_update.md | |
fi | |
- name: Commit and push updated image_update.md | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add image_update.md | |
git commit -m "Update image_update.md with Docker image and deletion info" | |
git push |