Skip to content

fix: 🐛 change routes #15

fix: 🐛 change routes

fix: 🐛 change routes #15

Workflow file for this run

name: Build and Push Angular Image to GHCR, and Deploy GithubPages
on:
push:
branches: [main]
permissions:
contents: write
jobs:
build:
name: Build and push to GHCR
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from VERSION file
id: get-version
run: |
if [ -f VERSION ]; then
VERSION=$(cat VERSION)
else
echo "VERSION file not found. Exiting..."
exit 1
fi
echo "Current version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Login GHCR
run: |
docker login --username Aanttrax --password ${{ secrets.GH_PT }} ghcr.io
- name: Tag Docker and build image with semantic version
run: |
docker build . \
--build-arg NG_APP_TEMPLATE_ID=$NG_APP_TEMPLATE_ID \
--build-arg NG_APP_SERVICE_ID=$NG_APP_SERVICE_ID \
--build-arg NG_APP_PUBLIC_KEY=$NG_APP_PUBLIC_KEY \
--build-arg NG_APP_USER_NAME=$NG_APP_USER_NAME \
-t ghcr.io/aanttrax/portfolio:${{ steps.get-version.outputs.version }}
env:
NG_APP_TEMPLATE_ID: ${{ secrets.NG_APP_TEMPLATE_ID }}
NG_APP_SERVICE_ID: ${{ secrets.NG_APP_SERVICE_ID }}
NG_APP_PUBLIC_KEY: ${{ secrets.NG_APP_PUBLIC_KEY }}
NG_APP_USER_NAME: Aanttrax
- name: Push Docker image to GHCR
run: |
docker push ghcr.io/aanttrax/portfolio:${{ steps.get-version.outputs.version }}
deploy:
name: Build and deploy to GITHUBPAGES
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from VERSION file
id: get-version
run: |
if [ -f VERSION ]; then
VERSION=$(cat VERSION)
else
echo "VERSION file not found. Exiting..."
exit 1
fi
echo "Current version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Modify Base Href
run: |
sed -i 's/RUN ng build/RUN ng build --base-href="\/portfolio\/" --deploy-url="\/portfolio\/"/' Dockerfile
sed -i 's/..\/assets\//..\/portfolio\/assets\//' src/app/data/portfolio.data.ts
- name: Tag Docker and build image with semantic version
run: |
docker build . \
--build-arg NG_APP_TEMPLATE_ID=$NG_APP_TEMPLATE_ID \
--build-arg NG_APP_SERVICE_ID=$NG_APP_SERVICE_ID \
--build-arg NG_APP_PUBLIC_KEY=$NG_APP_PUBLIC_KEY \
--build-arg NG_APP_USER_NAME=$NG_APP_USER_NAME \
-t portfolio:${{ steps.get-version.outputs.version }}
- name: Extract Content from Image
run: |
container_id=$(docker create portfolio:${{ steps.get-version.outputs.version }})
docker cp $container_id:/usr/share/nginx/html ./public
docker rm $container_id
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public/html