Handle structured texts impossible to change #96
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
jobs: | |
Deploy: | |
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.2 | |
bundler-cache: true | |
- uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Install dependencies | |
run: | | |
gem install kamal | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set Destination | |
run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
echo "KAMAL_DESTINATION=production" >> $GITHUB_ENV | |
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then | |
echo "KAMAL_DESTINATION=staging" >> $GITHUB_ENV | |
fi | |
- name: Deploy Application | |
env: | |
GCR_API_TOKEN: ${{ secrets.GCR_API_TOKEN }} | |
PRIVATE_KEY: ${{ secrets.KAVO_PRIVATE_KEY }} | |
run: | | |
sed -i -E -e '/^SECRETS=/d' -e 's/^GITHUB_CONTAINER_REGISTRY_API_TOKEN=.*$/GITHUB_CONTAINER_REGISTRY_API_TOKEN=$GCR_API_TOKEN/' .kamal/secrets.$KAMAL_DESTINATION | |
kamal deploy -d $KAMAL_DESTINATION |