Legg til vedlegg til inkallingen #28
Workflow file for this run
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 to beta.fb2.no | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
pull_request: | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "deploy" | |
deploy: | |
name: "Deploy to beta.fb2.no" | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/deploy.key | |
chmod 600 ~/.ssh/deploy.key | |
cat >>~/.ssh/config <<END | |
Host fb2 | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/deploy.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_KEY: ${{ secrets.SSH_KEY }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
- name: Pull branch | |
run: ssh fb2 'cd fb2-hjemmeside && git fetch && git checkout ${{env.BRANCH_NAME}} && git reset --hard origin/${{env.BRANCH_NAME}}' | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
- name: Publish beta fb2-hjemmeside | |
run: ssh fb2 'sh publish_beta.sh' |