-
Notifications
You must be signed in to change notification settings - Fork 68
62 lines (57 loc) · 2.56 KB
/
deploy.yml
File metadata and controls
62 lines (57 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This is a basic workflow to help you get started with Actions
name: Deploy!!
# Controls when the workflow will run
on:
# Triggers the workflow on push events, but only on "master" branch
push:
branches: [ "master" ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3 # Checks-out your repository, so your job can access it
- name: Declare some variables
#Example code to show "meta commands"
# that can be used to pass variable info to be used later
id: vars
shell: bash
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" #Gets the short sha from the commit
# Runs a set of commands using the runners shell
- name: Run some tests as multiline bash
# This is just and example to show that the file test.txt
# is available here in the pipeline. You can
# of course run way more complicated test suites.
# (The code verifies that test.txt contains the substring assigned to the SUB variable,
# and fails the test otherwise)
run: |
STR=$(cat editme.txt)
SUB='developer'
if [[ "$STR" == *"$SUB"* ]]; then
echo "Successfully ran test for {{vars.sha_short}}. The file looks okay."
exit 0
fi
exit 1
# ----- DO NOT UNCOMMENT THIS, ONLY FOR EXAMPLE -----
# NB: Note that this also requires a Dockerfile etc which this repository is missing.
# run: |
# docker version
# docker build \
# --build-arg 'GIT_COMMIT=${{ github.sha }}' \
# -t my-cool-app:latest \
# .
# echo "Built image (git commit: ${{ github.sha }} tag: my-cool-app:latest)"
# - uses: azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf #Login to azure from pipeline
# with:
# client-id: ${{ secrets.client-id }}
# tenant-id: ${{ secrets.tenant-id }}
# subscription-id: ${{ secrets.subscription-id }}
# - run: |
# image_url="my-registry.azure.containerregistry.com/my-cool-app"
# docker tag ${{ my-cool-app }}:latest ${image_url}:${{ github.sha }}
# az acr login --name my-registry.azure.containerregistry.com
# docker push ${image_url}:${{ github.sha }}
# ----- EXAMPLE DOCKER PUSH ENDS HERE ------