Skip to content

Instantly share code, notes, and snippets.

@codeorelse
Created September 2, 2021 06:25
Show Gist options
  • Save codeorelse/ff0def016c9c2bbf26a4c9d44ea40c22 to your computer and use it in GitHub Desktop.
Save codeorelse/ff0def016c9c2bbf26a4c9d44ea40c22 to your computer and use it in GitHub Desktop.
Daily Energy Github Action
# This is a basic workflow to help you get started with Actions
name: Stage - CI CD
# Controls when the action will run.
on:
push:
tags:
- Release/Stage/**
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# First job: build
job_1:
name: Stage - build
# The type of runner that the job will run on
runs-on: windows-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@v2
name: Checkout Code
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.0.2
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Restore NuGet Packages
run: nuget restore dailyenergy.nl.sln
- name: Build and Publish Web App
run: msbuild dailyenergy.nl.sln /p:Configuration=Stage /p:DeployOnBuild=true /p:PublishProfile=Staging
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: published_DailyEnergyStage
path: DailyEnergy.Site/bin/app.publish/Staging
# Second job: Deploy to ftp
job_2:
name: Stage - deploy
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: job_1
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: published_DailyEnergyStage
path: DailyEnergy.Site/bin/app.publish/Staging
- name: Sync published files with server
uses: SamKirkland/FTP-Deploy-Action@4.0.0
with:
server: windowsftp.webhosting.be
username: stagegit@dailyenergy.nl
password: ${{ secrets.FTP_USER_PASSWORD }}
port: 21
protocol: ftps-legacy
local-dir: ./DailyEnergy.Site/bin/app.publish/Staging/
server-dir: /subsites/stage.dailyenergy.nl/
dry-run: true
log-level: verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment