Skip to content

Commit

Permalink
Deploy unstable/unreleased snage version to snage.ff-labs.de
Browse files Browse the repository at this point in the history
  • Loading branch information
tvrg committed May 18, 2020
1 parent da894a1 commit 2a707bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,35 @@ jobs:
- run: yarn lerna run build
env:
BUILD_VERSION: ${{ env.VERSION }}
- name: Publish to Docker and NPM
if: startsWith(github.ref, 'refs/tags/v')
- name: Publish master as snage/snage:unstable to Docker
if: github.ref == 'refs/heads/master'
run: |
echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > $HOME/.npmrc
docker build -t snage/snage:${VERSION} packages/snage
docker push snage/snage:${VERSION}
(cd packages/snage && yarn publish --new-version "${VERSION}" --no-git-tag-version)
docker build -t snage/snage:unstable packages/snage
docker push snage/snage:unstable
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deploy snage.ff-labs.de
if: github.ref == 'refs/heads/master'
run: |
export SNAGE_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
export ANSIBLE_PRIVATE_KEY_FILE="$HOME/id_rsa"
echo "$SSH_KEY" > $HOME/id_rsa
chmod 600 $HOME/id_rsa
ansible-playbook -i [email protected], -e "SNAGE_VERSION=${SNAGE_VERSION}" ansible/deploy-snage.yml
ansible-playbook -i [email protected], -e "SNAGE_VERSION=unstable" ansible/deploy-snage.yml
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
ANSIBLE_HOST_KEY_CHECKING: false
- name: Publish Release to Docker and NPM
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > $HOME/.npmrc
docker build -t snage/snage:${VERSION} packages/snage
docker push snage/snage:${VERSION}
(cd packages/snage && yarn publish --new-version "${VERSION}" --no-git-tag-version)
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions ansible/deploy-snage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
name: 'snage'
image: 'snage/snage:{{ SNAGE_VERSION }}'
command: serve --config /var/snage/.snage.yaml
pull: yes
recreate: yes
state: started
restart: yes
Expand Down

0 comments on commit 2a707bf

Please sign in to comment.