-
-
Notifications
You must be signed in to change notification settings - Fork 49
109 lines (109 loc) · 3.89 KB
/
ci.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Continuous Integration
on:
push:
branches:
- 'master'
pull_request:
jobs:
get-previous-tag-with-working-directory:
name: Test Get Previous Tag on ${{ matrix.os }} with Working Directory
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- uses: actions/checkout@v4
with:
repository: WyriHaximus/php-fake-php-version
ref: master
path: tmp/some/other/path
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: 'Get Previous tag'
id: previoustag
uses: ./
with:
workingDirectory: tmp/some/other/path
- run: |
echo "Tag: ${{ steps.previoustag.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}"
test -n "${{ steps.previoustag.outputs.tag }}"
test -n "${{ steps.previoustag.outputs.timestamp }}"
- name: Assert we got the tag
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: 1.8.38
actual: ${{ steps.previoustag.outputs.tag }}
get-previous-tag:
name: Test Get Previous Tag on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: 'Get Previous tag'
id: previoustag
uses: ./
- run: |
echo "Tag: ${{ steps.previoustag.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}"
test -n "${{ steps.previoustag.outputs.tag }}"
test -n "${{ steps.previoustag.outputs.timestamp }}"
- name: Assert we got the tag
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: v1
actual: ${{ steps.previoustag.outputs.tag }}
- name: Add tag with prefix
run: |
git tag tag-with-prefix-v1.0.0
- name: 'Get Previous tag with prefix'
id: previoustagwithprefix
uses: ./
with:
prefix: tag-with-prefix-v
- run: |
echo "Tag: ${{ steps.previoustagwithprefix.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustagwithprefix.outputs.timestamp }}"
test -n "${{ steps.previoustagwithprefix.outputs.tag }}"
test -n "${{ steps.previoustagwithprefix.outputs.timestamp }}"
- name: Remove tags
run: |
rm -r .git/refs/tags
- name: Assert we got the tag with the expected prefix
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: tag-with-prefix-v1.0.0
actual: ${{ steps.previoustagwithprefix.outputs.tag }}
- name: 'Get Previous tag with fallback'
id: previoustagwithfallback
uses: ./
with:
fallback: v1.0.0
- run: |
echo "Tag: ${{ steps.previoustagwithfallback.outputs.tag }}"
echo "Timestamp: ${{ steps.previoustagwithfallback.outputs.timestamp }}"
test -n "${{ steps.previoustagwithfallback.outputs.tag }}"
test -n "${{ steps.previoustagwithfallback.outputs.timestamp }}"
- name: Assert we got the fallback
uses: therussiankid92/gat@v1
with:
assertion: should.equal
expected: v1.0.0
actual: ${{ steps.previoustagwithfallback.outputs.tag }}