Skip to content

Commit

Permalink
try ko again
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima committed Jan 11, 2024
1 parent 7874738 commit 8a6e1ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
32 changes: 11 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,19 @@ name: Deploy to Server
on:
push:
branches:
- master
- compose2

jobs:
deploy:
publish:
name: Publish
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install SSH key
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$SERVER_IP" >> ~/.ssh/known_hosts
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_IP: ${{ secrets.SERVER_IP }}
- uses: actions/setup-go@v4
with:
go-version: '1.21.x'
- uses: actions/checkout@v3

- name: SSH into the server and update the code
run: |
ssh $SERVER_USERNAME@$SERVER_IP 'cd /root/ytstalker && git pull && export PATH=$PATH:/usr/local/go/bin && go build . && systemctl restart ytstalker.service'
env:
SERVER_USERNAME: ${{ secrets.SERVER_USERNAME }}
SERVER_IP: ${{ secrets.SERVER_IP }}
- uses: ko-build/setup-ko@v0.6
- run: |
echo "${GITHUB_TOKEN}" | ko login https://ghcr.io --username thedmdim --password-stdin
ko build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ RUN CGO_ENABLED=0 go build -v -o /usr/bin/ytstalker/app ./app
FROM alpine
WORKDIR /usr/bin/ytstalker
COPY --from=builder /usr/bin/ytstalker/app .
COPY web /usr/bin/ytstalker/web
COPY web /usr/bin/ytstalker/web/
EXPOSE 80
ENTRYPOINT ["/usr/bin/ytstalker/app"]

0 comments on commit 8a6e1ea

Please sign in to comment.