Skip to content

v0.2.3

v0.2.3 #24

Workflow file for this run

name: Build and Publish
on:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Maven
run: mvn clean install
- name: Build Docker image
run: docker build -t my-storage-image .
- name: Log into GitHub Packages
run: echo "${{ secrets.PERSONAL_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.actor }}" --password-stdin
- name: Tag Docker image
run: docker tag my-storage-image docker.pkg.github.com/narvane/my-storage/my-storage-image:${{ github.event.release.tag_name }}
- name: Push Docker image to GitHub Packages
run: docker push docker.pkg.github.com/narvane/my-storage/my-storage-image:${{ github.event.release.tag_name }}
deploy:
runs-on: ubuntu-latest
steps:
- name: Install sshpass
run: sudo apt-get install -y sshpass
- name: SSH into Server and deploy
run: |
sshpass -p ${{ secrets.SERVER_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} '
cd my-routine/my-storage/k8s &&
rm -rf my-storage/k8s &&
git clone https://github.com/Narvane/my-storage.git k8s &&
cd k8s &&
git config core.sparseCheckout true &&
echo "my-routine/my-storage/k8s/*" >> .git/info/sparse-checkout &&
git pull origin master
'
# publish:
# runs-on: ubuntu-latest
#
# steps:
# - name: Log into GitHub Packages
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u "${{ github.actor }}" --password-stdin
#
# - name: Tag Docker image
# run: docker tag my-storage-image:latest docker.pkg.github.com/narvane/my-storage/my-storage-image:${{ github.event.release.tag_name }}
#
# - name: Push Docker image to GitHub Packages
# run: docker push docker.pkg.github.com/narvane/my-storage/my-storage-image:${{ github.event.release.tag_name }}