diff --git a/.forgejo/workflows/deploy_hosted.yml b/.forgejo/workflows/deploy_hosted.yml index f945a6b3fa..0c09c50f23 100644 --- a/.forgejo/workflows/deploy_hosted.yml +++ b/.forgejo/workflows/deploy_hosted.yml @@ -52,27 +52,35 @@ jobs: - name: Zipping dist file run: | - mv dist /tmp/${{ github.ref_name }} + BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g') + mv dist /tmp/${{ BRANCH }} cd /tmp - zip ${{ github.ref_name }}.zip -r ${{ github.ref_name }}/* + zip ${{ BRANCH }}.zip -r ${{ BRANCH }}/* cd - - name: uploading file - run: scp /tmp/${{ github.ref_name }}.zip hetzner:/root/staging/ + run: | + BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g') + scp /tmp/${BRANCH}.zip hetzner:/root/staging/ - name: cleanup files - run: rm /tmp/${{ github.ref_name }}.zip && rm -rf /tmp/${{ github.ref_name }}/ + run: | + BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g') + rm /tmp/${BRANCH}.zip && r${GITHUB_REF_NAME}m -rf /tmp/${BRANCH}/ - name: unzipping remote file - run: ssh hetzner "cd /root/staging && rm -rf ${{ github.ref_name }} && unzip ${{ github.ref_name }}.zip && rm -rf /root/public/${{ github.ref_name }} && mv /root/staging/${{ github.ref_name }}/ /root/public/ && rm ${{ github.ref_name }}.zip" + run: | + BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g') + ssh hetzner "cd /root/staging && rm -rf ${BRANCH} && unzip ${BRANCH}.zip && rm -rf /root/public/${BRANCH} && mv /root/staging/${BRANCH}/ /root/public/ && rm ${BRANCH}.zip" - name: Comment on the PR run: | + BRANCH=$(echo ${{ github.ref_name }} | sed 's/\//-/g') PR_NUMBER=$(echo ${{ github.event.pull_request.number || github.event.issue.number }}) if [[ -n "$PR_NUMBER" ]] then echo "Found a pull request or issue number, will post to $PR_NUMBER ..." - MSG=$(echo "Congratulations! This PR been successfully built and has been deployed. It is (temporarily) available on https://builds.mapcomplete.org/${PR_NUMBER}") + MSG=$(echo "Congratulations! This PR been successfully built and has been deployed. It is (temporarily) available on https://builds.mapcomplete.org/${BRANCH}") BODY="{\"body\": \"$MSG\"}" # Token must have following permissions: issue > read and write curl -X POST "https://source.mapcomplete.org/api/v1/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \